Skip to content

Fix all release workflows - #78

Merged
rezrah merged 2 commits into
mainfrom
rezrah/fix-npm-token
Dec 16, 2025
Merged

Fix all release workflows#78
rezrah merged 2 commits into
mainfrom
rezrah/fix-npm-token

Conversation

@rezrah

@rezrah rezrah commented Dec 16, 2025

Copy link
Copy Markdown
Collaborator

Classic NPM tokens no longer work, so our release workflows are failing.

Fixes it by switching to a combo of:

  1. OIDC auhorized tokens for anything that doesn't need workflow follow-ups
  2. App tokens for anything that does

@rezrah
rezrah requested a review from a team as a code owner December 16, 2025 13:57
Copilot AI review requested due to automatic review settings December 16, 2025 13:57
@rezrah

rezrah commented Dec 16, 2025

Copy link
Copy Markdown
Collaborator Author

Deploy checks failing, but are non-blocking. Going to test in main branch next. cc. @danielguillan

@rezrah
rezrah merged commit 19b1c22 into main Dec 16, 2025
9 of 10 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the release workflow to address NPM token authentication failures by transitioning from classic NPM tokens to a dual authentication approach: OIDC-authorized tokens for operations that don't trigger follow-up workflows, and GitHub App tokens for those that do.

Key Changes:

  • Migrated release-main and release-canary jobs from reusable workflows to inline job definitions with GitHub App token authentication
  • Added workflow trigger filters to ignore merge queue branches and tags
  • Updated permissions to include write access for contents and pull-requests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +44 to +48
- uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42
id: app-token
with:
app-id: ${{ vars.PRIMER_APP_ID_SHARED }}
private-key: ${{ secrets.PRIMER_APP_PRIVATE_KEY_SHARED }}

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GitHub App token creation step is missing a descriptive name attribute. While this is not a functional issue, it would improve workflow readability and debugging to add a name like "Generate GitHub App token" or "Create app token", consistent with other named steps in the workflow.

Copilot uses AI. Check for mistakes.
Comment on lines +125 to +129
- uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42
id: app-token
with:
app-id: ${{ vars.PRIMER_APP_ID_SHARED }}
private-key: ${{ secrets.PRIMER_APP_PRIVATE_KEY_SHARED }}

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GitHub App token creation step is missing a descriptive name attribute. While this is not a functional issue, it would improve workflow readability and debugging to add a name like "Generate GitHub App token" or "Create app token", consistent with other named steps in the workflow.

Copilot uses AI. Check for mistakes.

release-canary:
if: ${{ github.repository == 'primer/doctocat-nextjs' && github.ref_name != 'main' && github.ref_name != 'changeset-release/main' }}
if: github.repository == 'primer/doctocat-nextjs' && github.ref_name != 'changeset-release/main'

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition for the canary job will now allow it to run on the main branch, causing both release-main and release-canary jobs to run simultaneously on main. The original condition included github.ref_name != 'main' to prevent this overlap. Consider restoring this check or adjusting the logic to ensure only one release job runs per branch.

Suggested change
if: github.repository == 'primer/doctocat-nextjs' && github.ref_name != 'changeset-release/main'
if: github.repository == 'primer/doctocat-nextjs' && github.ref_name != 'changeset-release/main' && github.ref_name != 'main'

Copilot uses AI. Check for mistakes.
Comment on lines 80 to 86
- name: Publish release candidate
run: |
npm exec --workspaces -- ../../packages/repo-configs/scripts/prepare-release-candidate
# We use OIDC token here because we don't need Bot to trigger additional workflows
npx changeset publish --tag next
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release-candidate job lacks NPM authentication configuration. While it uses the OIDC token (GITHUB_TOKEN) for GitHub operations, the changesets publish command needs to authenticate with npm to publish packages. The release-main and release-canary jobs have explicit authentication setup (app tokens), but this job is missing the necessary npm authentication mechanism. This will cause the publish step to fail.

See below for a potential fix:


      - name: Authenticate with NPM
        uses: actions/setup-node@v6
        with:
          node-version: 24
          registry-url: 'https://registry.npmjs.org/'
          cache: 'npm'
        env:
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

      - name: Publish release candidate
        run: |
          npm exec --workspaces -- ../../packages/repo-configs/scripts/prepare-release-candidate
          # We use OIDC token here because we don't need Bot to trigger additional workflows
          npx changeset publish --tag next
        env:
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants