You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use push_token for git operations to trigger CI on bot PRs (#275)
* fix(issue-auto-implement): use optional push_token so CI checks trigger on bot PRs
PRs created with GITHUB_TOKEN don't trigger pull_request workflows (GitHub
restriction). The previous workflow_dispatch workaround ran tests but results
didn't appear as PR checks. Add an optional push_token input (PAT or GitHub
App token) used for git push and PR creation — GitHub sees events from a real
user and triggers all pull_request workflows normally. Remove the
workflow_dispatch workaround and actions:write permission since they're no
longer needed.
https://claude.ai/code/session_01PHFVduUenioa8nn4NMCabe
* fix(issue-auto-implement): rename to AUTO_IMPLEMENT_GITHUB_PUSH_TOKEN, document all token types
Rename secret to include GITHUB in the name for consistency. Document that
push_token accepts personal PATs (classic or fine-grained) and GitHub App
installation tokens.
https://claude.ai/code/session_01PHFVduUenioa8nn4NMCabe
---------
Co-authored-by: Claude <noreply@anthropic.com>
1.**Workflow** — Ensure `.github/workflows/issue-auto-implement.yml` exists and calls this action (see the workflow in this repo for the exact `on:` and `uses:`). If implement might change workflow files, see [CI/CD](#cicd-what-you-need-to-run-this-workflow) for push permission requirements.
8
-
2.**Secrets and variables** — In the repo: Settings → Secrets and variables → Actions. Add secret **`AUTO_IMPLEMENT_ANTHROPIC_API_KEY`** (Anthropic API key). For who can trigger, set **one** of: **`AUTO_IMPLEMENT_ALLOWED_TRIGGER_MIN_PERMISSION`** (e.g. `push` or `maintain`; works with default token) or **`AUTO_IMPLEMENT_ALLOWED_TRIGGER_TEAM`** (e.g. `org/team`; token needs `read:org`).
8
+
2.**Secrets and variables** — In the repo: Settings → Secrets and variables → Actions. Add secret **`AUTO_IMPLEMENT_ANTHROPIC_API_KEY`** (Anthropic API key). Optionally add **`AUTO_IMPLEMENT_GITHUB_PUSH_TOKEN`** (a PAT with `repo` scope) so CI checks run on bot-created PRs (see [CI checks on bot-created PRs](#ci-checks-on-bot-created-prs)). For who can trigger, set **one** of: **`AUTO_IMPLEMENT_ALLOWED_TRIGGER_MIN_PERMISSION`** (e.g. `push` or `maintain`; works with default token) or **`AUTO_IMPLEMENT_ALLOWED_TRIGGER_TEAM`** (e.g. `org/team`; token needs `read:org`).
9
9
3.**Trigger label** — Create the labels once so you can add them to issues. Either run the **Issue auto-implement setup** workflow (Actions → Issue auto-implement setup → Run workflow), which creates `automation/auto-implement`, `automation/needs-info`, and `automation/pr-created`; or create the trigger label **`automation/auto-implement`** manually in the repo (Settings or Issues → Labels). The main action also ensures these labels exist when it runs, but the trigger label must exist before you can add it to an issue.
10
10
4.**Trigger** — On an issue, add the label `automation/auto-implement`. The workflow runs: it assesses the issue (request more info vs implement), and if implement, runs the Claude Code CLI and opens a PR. You can also comment on the issue (to add context and re-trigger) or review the PR (to iterate).
11
11
12
-
## CI and approval for bot-created PRs
12
+
## CI checks on bot-created PRs
13
13
14
-
PRs created by the action use `GITHUB_TOKEN`, so GitHub does not trigger `pull_request` workflows on them. This action therefore triggers the **test**workflow via `workflow_dispatch` on the new branch after creating a PR, so CI checks appear. The **test** workflow must include `workflow_dispatch:` in its `on:` block.
14
+
By default, PRs created with `GITHUB_TOKEN` do not trigger `pull_request` workflows (a GitHub restriction to prevent recursive runs). To get CI checks on bot-created PRs, set the optional **`push_token`**input to a PAT or GitHub App installation token. The action uses this token for `git push` and PR creation, so GitHub sees events from a non-Actions identity and triggers all `pull_request` workflows normally. Accepted token types:
15
15
16
-
To require a human to approve workflow runs before they execute (e.g. for security), set **Settings → Actions → General → Approval for running fork pull request workflows from contributors** to **Require approval for all external contributors**. Then each bot-created PR will show workflow(s) awaiting approval until someone with write access approves.
-**GitHub App installation token** — same permissions (e.g. via `actions/create-github-app-token`)
19
+
20
+
If `push_token` is not set, the action falls back to `github_token` and CI workflows will not trigger automatically on bot PRs.
17
21
18
22
## Extra workflow runs when the action adds labels
19
23
@@ -36,6 +40,7 @@ Used by `.github/workflows/issue-auto-implement.yml`. Requires `anthropic_api_ke
36
40
|`max_implement_retries`| No | 3 | Max retries on verify failure (cap 5) |
37
41
|`github_allowed_trigger_team`| No*| - | Team slug (e.g. org/team); only members can trigger. Repo variable `AUTO_IMPLEMENT_ALLOWED_TRIGGER_TEAM`. Ignored if min_permission is set. Token needs read:org. |
38
42
|`github_allowed_trigger_min_permission`| No*| - | Require actor has at least this repo permission: triage, push, maintain, or admin. Repo variable `AUTO_IMPLEMENT_ALLOWED_TRIGGER_MIN_PERMISSION`. Works with default GITHUB_TOKEN. |
43
+
|`push_token`| No | - | PAT or GitHub App installation token for git push and PR creation. When set, GitHub triggers `pull_request` workflows on bot PRs. Falls back to `github_token`. |
39
44
|`post_pr_comment`| No | false | When true, post a comment on the issue linking to the new PR when one is created. |
40
45
41
46
*One of `github_allowed_trigger_min_permission` or `github_allowed_trigger_team` must be set (via repo variables).
@@ -47,7 +52,7 @@ Secrets and variables use an action-specific prefix (e.g. `AUTO_IMPLEMENT_`) so
47
52
To use this action in GitHub Actions:
48
53
49
54
1.**Workflow** — Call the action from a workflow (e.g. `.github/workflows/issue-auto-implement.yml`) on `issues.labeled`, `issue_comment`, `pull_request_review`, and/or `pull_request_review_comment`. The job needs `contents: write`, `issues: write`, `pull-requests: write`. If the implement step may edit files under `.github/workflows/`, GitHub may reject the push; the workflow syntax has no `workflows` permission key. Enable **Settings → Actions → General → Allow GitHub Actions to create and approve pull requests** (or use a PAT with appropriate scope) so the run can push workflow file changes.
50
-
2.**Secrets** — Add **`AUTO_IMPLEMENT_ANTHROPIC_API_KEY`** (repo secret). Used for the assess step and passed to the Claude Code CLI in the implement step.
55
+
2.**Secrets** — Add **`AUTO_IMPLEMENT_ANTHROPIC_API_KEY`** (repo secret). Used for the assess step and passed to the Claude Code CLI in the implement step. Optionally add **`AUTO_IMPLEMENT_GITHUB_PUSH_TOKEN`** (a PAT with `repo` scope, or fine-grained with `contents: write` + `pull-requests: write`) so CI checks run on bot-created PRs.
51
56
3.**Variables (trigger gate)** — Set **one** of:
52
57
-**`AUTO_IMPLEMENT_ALLOWED_TRIGGER_MIN_PERMISSION`** (repo variable): `triage`, `push`, `maintain`, or `admin`. Only users with at least this repo permission can trigger. Works with default `GITHUB_TOKEN`.
53
58
-**`AUTO_IMPLEMENT_ALLOWED_TRIGGER_TEAM`** (repo variable): org/team slug (e.g. `org/team-name`). Only team members can trigger. Token must have `read:org` (use a PAT if `GITHUB_TOKEN` lacks it).
@@ -59,6 +64,7 @@ No other setup is required. Optionally set `verify_commands` (default `go test .
59
64
## Secrets and variables (repo setup)
60
65
61
66
-**`AUTO_IMPLEMENT_ANTHROPIC_API_KEY`** (repo secret) — Claude API key for the assess and implement steps. Add under Settings → Secrets and variables → Actions.
67
+
-**`AUTO_IMPLEMENT_GITHUB_PUSH_TOKEN`** (repo secret, optional) — PAT or GitHub App installation token for git push and PR creation. When set, GitHub triggers `pull_request` workflows on bot PRs so CI checks appear. See [CI checks on bot-created PRs](#ci-checks-on-bot-created-prs) for accepted token types.
62
68
-**Trigger gate (set one):**
63
69
-**`AUTO_IMPLEMENT_ALLOWED_TRIGGER_MIN_PERMISSION`** (repo variable) — Require the triggering user to have at least this repo permission: `triage`, `push`, `maintain`, or `admin`. Works with the default `GITHUB_TOKEN`. Add under Settings → Secrets and variables → Actions → Variables.
64
70
-**`AUTO_IMPLEMENT_ALLOWED_TRIGGER_TEAM`** (repo variable) — GitHub Team slug (e.g. `org/team-name`) whose members may trigger. The first step checks `github.actor` against this team. The token needs `read:org`; if `GITHUB_TOKEN` lacks it, use a PAT and pass it as `github_token`.
Copy file name to clipboardExpand all lines: .github/actions/issue-auto-implement/action.yml
+10-15Lines changed: 10 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,9 @@ inputs:
33
33
github_allowed_trigger_min_permission:
34
34
description: 'Alternative to team check: require actor has at least this repo permission (triage, push, maintain, admin). Works with default GITHUB_TOKEN. Set via repo variable AUTO_IMPLEMENT_ALLOWED_TRIGGER_MIN_PERMISSION.'
35
35
required: false
36
+
push_token:
37
+
description: 'Optional PAT or GitHub App token for git push and PR creation. When provided, push and PR-creation use this token so GitHub triggers pull_request workflows (GITHUB_TOKEN does not trigger them). Falls back to github_token.'
38
+
required: false
36
39
post_pr_comment:
37
40
description: 'When true, post a comment on the issue linking to the new PR when one is created'
0 commit comments