Skip to content

chore(ci): use GitHub App token to create Rust toolchain update PR#49

Merged
lwshang merged 3 commits into
mainfrom
lwshang/ci_app_token
May 13, 2026
Merged

chore(ci): use GitHub App token to create Rust toolchain update PR#49
lwshang merged 3 commits into
mainfrom
lwshang/ci_app_token

Conversation

@lwshang
Copy link
Copy Markdown
Contributor

@lwshang lwshang commented May 12, 2026

Summary

  • PRs opened with GITHUB_TOKEN do not trigger CI checks — a GitHub security restriction to prevent recursive workflow loops.
  • Switch to the org-level GitHub App token (PR_AUTOMATION_BOT_PUBLIC_CLIENT_ID / PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY) when calling gh pr create, so CI is triggered on the auto-created PR.

Context

Test plan

  • Trigger the Update Rust Toolchain workflow manually once this merges and verify that CI checks run on the resulting PR.
    chore(toolchain): update Rust to 1.95.0 #51 was generated by dispatching the workflow from this PR branch. CI was triggered successfully. The check-repo-policies / Check Bot Policies failure there is expected — the workflow was dispatched from this PR branch, so the generated PR includes changes beyond rust-toolchain.toml.

lwshang and others added 2 commits May 12, 2026 19:13
PRs opened with GITHUB_TOKEN do not trigger CI checks. Switch to the
org-level GitHub App token so that CI runs on the auto-created PR.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ractice

- Switch to client-id + PR_AUTOMATION_BOT_PUBLIC_CLIENT_ID (from app-id)
- Bump create-github-app-token to v3.1.1
- Use pr-automation-bot-public[bot] as git committer identity
- Drop explicit permissions block (app token handles it)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lwshang lwshang marked this pull request as ready for review May 13, 2026 13:27
@lwshang lwshang requested a review from a team as a code owner May 13, 2026 13:27
@lwshang lwshang requested a review from Copilot May 13, 2026 13:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Rust toolchain auto-update workflow to open PRs using a GitHub App token so that CI runs on the generated PRs (instead of being suppressed for PRs created with GITHUB_TOKEN).

Changes:

  • Removes job-level GITHUB_TOKEN write permissions and introduces a GitHub App token creation step.
  • Switches gh pr create authentication from secrets.GITHUB_TOKEN to the GitHub App token.
  • Updates git commit author identity to the GitHub App bot.
Comments suppressed due to low confidence (1)

.github/workflows/update-rust-toolchain.yml:63

  • git push origin "$BRANCH" --force will use the credentials configured by actions/checkout (typically the default GITHUB_TOKEN), not the GitHub App token you generated for gh pr create. If the goal is for the automation to act entirely as the app (and to avoid relying on GITHUB_TOKEN write perms), create the app token before checkout and pass it via actions/checkout's token: input (or otherwise configure git to use ${{ steps.app-token.outputs.token }}) so the push is authenticated with the app token as well.
          git config user.name "pr-automation-bot-public[bot]"
          git config user.email "pr-automation-bot-public[bot]@users.noreply.github.com"
          git checkout -b "$BRANCH"
          git add rust-toolchain.toml
          git commit -m "$TITLE"
          git push origin "$BRANCH" --force


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

Comment thread .github/workflows/update-rust-toolchain.yml
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@lwshang lwshang merged commit 46339c7 into main May 13, 2026
15 checks passed
@lwshang lwshang deleted the lwshang/ci_app_token branch May 13, 2026 14:23
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.

3 participants