Skip to content

ci(release): use GitHub App token in release-prepare for PR creation#1317

Open
grdsdev wants to merge 2 commits intomainfrom
grdsdev/hartford-v1
Open

ci(release): use GitHub App token in release-prepare for PR creation#1317
grdsdev wants to merge 2 commits intomainfrom
grdsdev/hartford-v1

Conversation

@grdsdev
Copy link
Contributor

@grdsdev grdsdev commented Feb 24, 2026

Fixes the CI failure in the Prepare Release workflow where GITHUB_TOKEN is not permitted to create pull requests in this repo.

Adds a Generate token step using actions/create-github-app-token@v2 and passes the App token to the checkout step, so melos-action inherits it when opening the release PR — matching the same pattern already used in release-tag.yml and release-publish.yml.

🤖 Generated with Claude Code

GITHUB_TOKEN is not permitted to create PRs in this repo. Switch to the
GitHub App token (same pattern as release-tag and release-publish) so
melos-action can successfully open the release PR.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Updated release workflow to use an app-generated token for authentication in CI.
    • Switched the release tooling integration to a variant that supports supplying a custom token for creating release pull requests.

Walkthrough

The workflows were changed to use a GitHub App token for release steps. A new step calls actions/create-github-app-token@v2 with app-id and private-key from secrets to produce steps.app-token.outputs.token. The checkout step now uses that generated token instead of secrets.GITHUB_TOKEN. The Melos action reference was changed from bluefireteam/melos-action@v3 to grdsdev/melos-action@feat/custom-token-for-create-pr, and the generated token is passed into that action where applicable.

Sequence Diagram(s)

sequenceDiagram
    participant Runner as GitHub Actions Runner
    participant CreateToken as actions/create-github-app-token@v2
    participant GitHubApp as GitHub App (secrets: app-id, private-key)
    participant Checkout as actions/checkout
    participant Melos as grdsdev/melos-action (workflow)
    participant GitHub as GitHub API / Repo

    Runner->>CreateToken: invoke with app-id & private-key
    CreateToken->>GitHubApp: request installation token
    GitHubApp-->>CreateToken: return app installation token
    CreateToken-->>Runner: outputs.app-token (token)

    Runner->>Checkout: checkout repo with token=steps.app-token.outputs.token
    Checkout->>GitHub: authenticate & fetch repo

    Runner->>Melos: run melos-action with token=steps.app-token.outputs.token
    Melos->>GitHub: authenticate (create PRs / perform release ops)
    GitHub-->>Melos: API responses
    Melos-->>Runner: action results
Loading

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/release-prepare.yml (1)

44-50: ⚠️ Potential issue | 🟠 Major

Pass the app token as GH_TOKEN env var to the melos-action step for PR creation.

The app token is passed to the checkout step (line 37), which configures git credentials. However, when create-pr: true triggers PR creation, bluefireteam/melos-action@v3 invokes the GitHub CLI (gh pr create), which reads the token from the GH_TOKEN environment variable, not from git credentials.

This pattern is already demonstrated in release-tag.yml (line 51), where GH_TOKEN is explicitly passed when gh workflow run is invoked. Similarly, release-publish.yml passes the token to the GitHub Release action (line 79). The melos-action step in release-prepare.yml needs the same treatment.

Add the following to the melos-action step:

Suggested fix
      - name: Setup Melos
        uses: bluefireteam/melos-action@v3
+       env:
+         GH_TOKEN: ${{ steps.app-token.outputs.token }}
        with:
          run-versioning: ${{ inputs.prerelease == false }}
          run-versioning-prerelease: ${{ inputs.prerelease == true }}
          run-versioning-graduate: ${{ inputs.graduate == true }}
          create-pr: true
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-prepare.yml around lines 44 - 50, The melos-action
step (uses: bluefireteam/melos-action@v3) currently sets create-pr: true but
does not expose the app token to GH CLI; add an env entry for GH_TOKEN populated
from the workflow input (the same token used in the checkout step) so the action
can run gh pr create (e.g., add GH_TOKEN: ${{ inputs.token }} under the
melos-action step).
🧹 Nitpick comments (1)
.github/workflows/release-prepare.yml (1)

26-31: Consider storing APP_ID as a configuration variable (vars) rather than a secret.

GitHub's documentation recommends storing the app ID as a GitHub Actions configuration variable, not a secret, since the app ID is non-sensitive. The official action README and all GitHub-provided examples use ${{ vars.APP_ID }} for app-id. Storing it as a secret unnecessarily masks it in logs and exhausts secret quota.

⚙️ Suggested change
-          app-id: ${{ secrets.APP_ID }}
+          app-id: ${{ vars.APP_ID }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-prepare.yml around lines 26 - 31, The Generate
token step (id: app-token, uses: actions/create-github-app-token@v2) currently
reads app-id from secrets (secrets.APP_ID); change it to use a
repository/organization variable reference (vars.APP_ID) instead of a secret,
update any documentation or CI variable setup to add APP_ID as a GitHub Actions
variable, and remove or stop relying on the secrets.APP_ID entry to avoid
masking a non-sensitive app ID in logs and consuming secret quota.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In @.github/workflows/release-prepare.yml:
- Around line 44-50: The melos-action step (uses: bluefireteam/melos-action@v3)
currently sets create-pr: true but does not expose the app token to GH CLI; add
an env entry for GH_TOKEN populated from the workflow input (the same token used
in the checkout step) so the action can run gh pr create (e.g., add GH_TOKEN:
${{ inputs.token }} under the melos-action step).

---

Nitpick comments:
In @.github/workflows/release-prepare.yml:
- Around line 26-31: The Generate token step (id: app-token, uses:
actions/create-github-app-token@v2) currently reads app-id from secrets
(secrets.APP_ID); change it to use a repository/organization variable reference
(vars.APP_ID) instead of a secret, update any documentation or CI variable setup
to add APP_ID as a GitHub Actions variable, and remove or stop relying on the
secrets.APP_ID entry to avoid masking a non-sensitive app ID in logs and
consuming secret quota.

ℹ️ Review info

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Cache: Disabled due to Reviews > Disable Cache setting

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 711e5c9 and 618ce89.

📒 Files selected for processing (1)
  • .github/workflows/release-prepare.yml

Use grdsdev/melos-action@feat/custom-token-for-create-pr across all three
release workflows. Pass the App token to the melos-action in release-prepare
so peter-evans/create-pull-request uses it directly — the fork's token input
is the correct fix for the GITHUB_TOKEN PR creation restriction.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
.github/workflows/release-tag.yml (1)

26-27: app-id is non-sensitive — prefer vars.APP_ID over secrets.APP_ID.

The official marketplace recommends storing the App's ID in repository environment variables rather than secrets. Using a secret unnecessarily masks the app ID in logs, making debugging harder without any real security benefit.

-          app-id: ${{ secrets.APP_ID }}
+          app-id: ${{ vars.APP_ID }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-tag.yml around lines 26 - 27, Replace the
unnecessary secret usage for the App ID in the workflow: change the app-id input
that currently uses secrets.APP_ID to use repository variables (vars.APP_ID)
while keeping private-key as secrets.PRIVATE_KEY; update the app-id line (the
key named "app-id" in the release-tag.yml job step) to reference ${{ vars.APP_ID
}} so the App ID is stored as a non-sensitive repo variable for easier logging
and debugging.
.github/workflows/release-publish.yml (1)

32-33: Same vars.APP_ID recommendation as in release-tag.yml.

app-id is not sensitive — store it as a configuration variable rather than a secret for consistency with the official actions/create-github-app-token usage examples.

-          app-id: ${{ secrets.APP_ID }}
+          app-id: ${{ vars.APP_ID }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-publish.yml around lines 32 - 33, The workflow
currently uses a secret for the GitHub App ID; change the `app-id` input to use
a repository/organization variable instead of a secret by replacing `${{
secrets.APP_ID }}` with `${{ vars.APP_ID }}` in the
`.github/workflows/release-publish.yml` action step (keep `private-key: ${{
secrets.PRIVATE_KEY }}` as-is); update any documentation or workflow docs to
state APP_ID is stored in vars and not in secrets to match
`actions/create-github-app-token` examples.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/release-publish.yml:
- Line 47: The workflow references a mutable fork branch
"grdsdev/melos-action@feat/custom-token-for-create-pr" which is a supply-chain
risk; replace that branch ref with an immutable commit SHA (or an official
released tag) for grdsdev/melos-action so the action is pinned to a specific
commit, matching the same pinned ref used in release-tag.yml; update the "uses:"
value to the selected commit SHA for grdsdev/melos-action and ensure any other
workflow references use the identical immutable ref.

In @.github/workflows/release-tag.yml:
- Line 39: Replace the mutable branch ref
grdsdev/melos-action@feat/custom-token-for-create-pr with a pinned full commit
SHA for that fork (e.g. grdsdev/melos-action@<full-commit-sha>) so the action
cannot change between runs; alternatively switch to the upstream official
release (e.g. bluefireteam/melos-action@<tag-or-sha>) if available—update the
uses: line accordingly to reference the exact commit SHA.

---

Nitpick comments:
In @.github/workflows/release-publish.yml:
- Around line 32-33: The workflow currently uses a secret for the GitHub App ID;
change the `app-id` input to use a repository/organization variable instead of a
secret by replacing `${{ secrets.APP_ID }}` with `${{ vars.APP_ID }}` in the
`.github/workflows/release-publish.yml` action step (keep `private-key: ${{
secrets.PRIVATE_KEY }}` as-is); update any documentation or workflow docs to
state APP_ID is stored in vars and not in secrets to match
`actions/create-github-app-token` examples.

In @.github/workflows/release-tag.yml:
- Around line 26-27: Replace the unnecessary secret usage for the App ID in the
workflow: change the app-id input that currently uses secrets.APP_ID to use
repository variables (vars.APP_ID) while keeping private-key as
secrets.PRIVATE_KEY; update the app-id line (the key named "app-id" in the
release-tag.yml job step) to reference ${{ vars.APP_ID }} so the App ID is
stored as a non-sensitive repo variable for easier logging and debugging.

ℹ️ Review info

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Cache: Disabled due to Reviews > Disable Cache setting

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 618ce89 and e9852f3.

📒 Files selected for processing (3)
  • .github/workflows/release-prepare.yml
  • .github/workflows/release-publish.yml
  • .github/workflows/release-tag.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/release-prepare.yml


- name: Bootstrap with Melos
uses: bluefireteam/melos-action@v3
uses: grdsdev/melos-action@feat/custom-token-for-create-pr
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Same mutable fork branch ref as in release-tag.yml — pin to a commit SHA.

grdsdev/melos-action@feat/custom-token-for-create-pr is a mutable branch pointer on a personal fork. The same supply chain risk applies here: force-pushing the branch silently changes what code runs, and this workflow handles the full publish flow including pub.dev publishing and GitHub Release creation.

-        uses: grdsdev/melos-action@feat/custom-token-for-create-pr
+        uses: grdsdev/melos-action@<full-commit-sha>  # feat/custom-token-for-create-pr
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-publish.yml at line 47, The workflow references a
mutable fork branch "grdsdev/melos-action@feat/custom-token-for-create-pr" which
is a supply-chain risk; replace that branch ref with an immutable commit SHA (or
an official released tag) for grdsdev/melos-action so the action is pinned to a
specific commit, matching the same pinned ref used in release-tag.yml; update
the "uses:" value to the selected commit SHA for grdsdev/melos-action and ensure
any other workflow references use the identical immutable ref.


- name: Setup Melos
uses: bluefireteam/melos-action@v3
uses: grdsdev/melos-action@feat/custom-token-for-create-pr
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Pin the fork action to a full commit SHA instead of a mutable branch ref.

grdsdev/melos-action@feat/custom-token-for-create-pr is a branch pointer on a personal fork. If the branch is force-pushed or the fork is compromised, the next workflow run silently executes different code with access to APP_ID, PRIVATE_KEY, and a valid installation token. Pinning to a commit SHA is the standard mitigation.

-        uses: grdsdev/melos-action@feat/custom-token-for-create-pr
+        uses: grdsdev/melos-action@<full-commit-sha>  # feat/custom-token-for-create-pr

If this fork is intended only as a temporary bridge, consider opening a PR upstream to bluefireteam/melos-action so you can return to an official, versioned release.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-tag.yml at line 39, Replace the mutable branch ref
grdsdev/melos-action@feat/custom-token-for-create-pr with a pinned full commit
SHA for that fork (e.g. grdsdev/melos-action@<full-commit-sha>) so the action
cannot change between runs; alternatively switch to the upstream official
release (e.g. bluefireteam/melos-action@<tag-or-sha>) if available—update the
uses: line accordingly to reference the exact commit SHA.

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.

1 participant