fix: create triage PRs as Imagile Bot - #290
Conversation
Use a short-lived GitHub App installation token for Claude operations, branch pushes, and PR creation so automated PR workflows run without manual approval. Closes #289 Generated-with: OpenAI Codex (GPT-5)
|
Claude finished @kolatts's task in 2m 41s —— View job Code Review
Summary: The approach is sound. Reducing
Neither is blocking — (1) will surface immediately on the first triage run. |
| env: | ||
| GH_TOKEN: ${{ steps.imagile-token.outputs.token }} | ||
| run: | | ||
| BOT_LOGIN="${{ steps.imagile-token.outputs.app-slug }}[bot]" |
There was a problem hiding this comment.
Minor security hardening — ${{ steps.imagile-token.outputs.app-slug }} is evaluated by the Actions runner and interpolated verbatim into the shell script before the shell sees it. GitHub App slugs are lowercase-alphanumeric-hyphen, so this is low-risk in practice — but binding through an env var is the defensive pattern that keeps the value as data rather than code:
| BOT_LOGIN="${{ steps.imagile-token.outputs.app-slug }}[bot]" | |
| env: | |
| GH_TOKEN: ${{ steps.imagile-token.outputs.token }} | |
| APP_SLUG: ${{ steps.imagile-token.outputs.app-slug }} | |
| run: | | |
| BOT_LOGIN="${APP_SLUG}[bot]" |
| steps: | ||
| - name: Generate Imagile Bot token | ||
| id: imagile-token | ||
| uses: actions/create-github-app-token@v3 |
There was a problem hiding this comment.
Verify the action version — as of August 2025 actions/create-github-app-token was at v1. If v3 was released after that it's fine, but worth a quick double-check that it exists and the permission-* inputs you're using (lines 24–27) are supported in this version. The workflow will fail at the token-generation step if the version tag doesn't resolve.
There was a problem hiding this comment.
PASS — architecture is sound and the security posture is clearly improved.
What this does well:
- Reducing
GITHUB_TOKENtocontents: readand moving all write operations to the App installation token is exactly the right model. PRs created by an App identity are not throttled into the manual-approval queue the wayGITHUB_TOKEN-created PRs are. - Generating a short-lived installation token scoped to
contents,pull-requests,issues, andworkflowswrite is appropriate — no over-scoping. - Resolving the bot identity dynamically from
app-slugrather than hardcoding the login string is robust; it will survive app renames. - Passing
github_token,bot_id, andbot_nameintoclaude-code-actionensures Claude's git operations (commits, pushes) carry the bot's identity, not the runner's default.
Two things to check before merging:
actions/create-github-app-token@v3(line 20) — As of my knowledge cutoffv1was the latest. Verifyv3exists and that thepermission-*inputs (lines 24–27) are supported in that version; the step will hard-fail if the tag doesn't resolve.- Expression injection in shell (line 34) —
${{ steps.imagile-token.outputs.app-slug }}is interpolated into the shell before the shell runs it. App slugs are safe in practice (lowercase-alphanumeric-hyphen), but the defensive pattern is to bind it throughenv:so it enters as data. Inline suggestion posted.
Neither is blocking; (1) will surface immediately on the first triage run and (2) is low-risk given GitHub's slug format constraints. Happy to approve.
|
Claude finished @kolatts's task in 2m 29s —— View job Code Review
Summary: The approach is sound. Reducing What this does well:
Two items flagged — non-blocking, both will surface on the first triage run:
Minor:
|
Summary
GITHUB_TOKENto read-only repository contentsWhy
GitHub places workflows triggered by pull requests created with the repository
GITHUB_TOKENinto an approval-required state. Creating and updating the automated branch and PR with a separate GitHub App installation token allows the normal PR workflows to start without that special manual approval.Repository configuration
IMAGILE_BOT_APP_IDIMAGILE_BOT_PRIVATE_KEYBoth have been configured directly in the repository. No credential material is committed.
The installed App must grant Contents, Pull requests, Issues, and Workflows read/write permissions requested by the token-generation step.
Validation
git diff --checkimagile-bot[bot]The definitive end-to-end validation will be a triage-created PR after this workflow change reaches
main.Closes #289