636 Commits

Author SHA1 Message Date
Kyungil Park
9441a7fe22
fix: clear stale claude-prompts dir before each write (#1288)
Previously, prompt files at `${RUNNER_TEMP}/claude-prompts/` from a prior
invocation could persist on non-ephemeral self-hosted runners (where the
documented `RUNNER_TEMP` cleanup contract is not reliably honored). In
particular, `claude-user-request.txt` is only written by `create-prompt`
when a user request exists; an `agent`-mode invocation does not overwrite
it, so a stale value left by an earlier mention-mode job in another repo
would leak into a later agent-mode job's effective context on the same
runner agent.

Fix: `rm -rf` the directory before `mkdir` in both write sites
(`src/create-prompt/index.ts`, `src/modes/agent/index.ts`). Idempotent,
safe on hosted runners (where the dir is already empty), and self-heals
on self-hosted runners.

Closes #1287
2026-06-11 21:18:57 -07:00
Kiwi
b371255139
pin setup-bun path for post steps (#1365)
Signed-off-by: kiwigitops <kiwisclubco@gmail.com>
2026-06-11 21:18:24 -07:00
Stephen Cobbe
84d317e8f9
fix: break SDK iterator after result message to prevent hang (#1339)
In some workflow contexts — reliably reproducible for us on
pull_request-triggered runs of this action — the Claude Agent SDK
query() async iterator does not close after the terminal result
message is emitted. The for-await loop in runClaudeWithSdk blocks
indefinitely after Claude has finished its work, until the workflow's
timeout-minutes cap kills the job.

Symptoms observed in production (4× in our scan-reviewer workflow):
- Claude completes successfully: SDK emits { type: "result",
  subtype: "success", ... } with the cost / turns / duration set.
- The action then sits with zero log output for the rest of
  timeout-minutes (we measured 18-19 min of dead time after result).
- The job is cancelled at timeout. writeExecutionFile is never
  called → no claude-execution-output.json → cost-tracker and other
  post-steps see nothing.
- Run shows as cancelled, even though Claude did its work and any
  verdict it posted via gh tools already landed.

Author-mode (workflow_dispatch) runs from the same codebase
terminate cleanly the same day, so the hang is specific to certain
event triggers.

By SDK contract the result message is terminal — no further messages
follow. Break out of the loop immediately after capturing it,
regardless of whether the upstream iterator ever closes. If the SDK
is later fixed to close cleanly in all contexts, this break becomes
a no-op.
2026-06-11 21:17:47 -07:00
Nikita Kirsanov
cd59d5df0d
fix: fall back to inherited env for auth when inputs are empty (#1342)
The "Run Claude Code Action" step maps the auth inputs into env
unconditionally:

    ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
    CLAUDE_CODE_OAUTH_TOKEN: ${{ inputs.claude_code_oauth_token }}

When the input is empty — whether because the caller supplied auth via
the step `env:` block (as reported in #676) or because the `with:` value
resolves empty in some runner/secret configurations — this assignment
overwrites the inherited env value with an empty string. validate-env
then fails with the misleading "Either ANTHROPIC_API_KEY or
CLAUDE_CODE_OAUTH_TOKEN is required" error even though the caller did
provide a token.

Fall back to the inherited env var when the input is empty, mirroring the
existing `${{ env.X }}` pattern already used a few lines below for
ANTHROPIC_BASE_URL / ANTHROPIC_CUSTOM_HEADERS. The input still takes
precedence; nothing changes for workflows that pass auth via `with:`.

Fixes #676
2026-06-11 21:17:22 -07:00
bymle
8046d850b5
docs(faq): correct rebase FAQ to match actual behavior (#1370)
The "Why won't Claude rebase my branch?" FAQ told users they could
enable rebasing by passing `--allowedTools "Bash(git rebase:*)"` via
claude_args. This does not work: the system prompt built in
src/create-prompt/index.ts unconditionally instructs Claude that it
cannot merge, rebase, or perform branch operations beyond creating and
pushing commits, so Claude declines rebase requests regardless of the
allowed tools.

Update the FAQ to describe the actual behavior and point users to the
real workaround (rebase locally or via the Claude Code CLI).

Closes #1286

Co-authored-by: bymle <229636660+bymle@users.noreply.github.com>
2026-06-11 21:16:55 -07:00
MateusSilva
ee2b19d882
test: add unit tests for parseGitHubContext and context type guards (#1404)
* test: add unit tests for parseGitHubContext and context type guards

Covers all supported webhook event types (entity and automation),
the pull_request_target normalization, isPR detection for comments
on pull requests, env-derived input defaults and parsing, and the
nine type guard functions. Raises src/github/context.ts line
coverage from 26.5% to 100%.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test: assert all env-derived inputs to close mutation testing gaps

Mutation testing (StrykerJS, 138 mutants) showed 22 surviving mutants
in the env input parsing of parseGitHubContext: fields like
trackProgress, includeFixLinks, allowedBots and the comment actor
filters were never asserted. Asserting every input field in both the
defaults and the explicit-values tests, plus covering the optional
chaining on payload.repository, brings the mutation score for
src/github/context.ts from 84.06% to 100%.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 21:16:45 -07:00
GitHub Actions
ebcdfe6dc6 chore: bump Claude Code to 2.1.174 and Agent SDK to 0.3.174 v1.0.145 2026-06-12 01:17:25 +00:00
GitHub Actions
0f97b95b65 chore: bump Claude Code to 2.1.173 and Agent SDK to 0.3.173 v1.0.144 2026-06-11 05:43:00 +00:00
GitHub Actions
eee73e2ae5 chore: bump Claude Code to 2.1.172 and Agent SDK to 0.3.172 v1.0.143 2026-06-10 21:01:40 +00:00
Chase McCoy
232c9a15f4
Drop --tsconfig-override from Bun invocations to avoid runtime crash (#1315)
* Drop --tsconfig-override from Bun invocations to avoid runtime crash

Passing --tsconfig-override to `bun run` triggers a Bun runtime bug
("Internal error: directory mismatch for directory .../tsconfig.json")
that aborts the action with exit code 1 before any work is done.

Bun already auto-discovers the action's own tsconfig.json by walking up
the directory tree from the entry file, so the override is redundant —
the workspace's tsconfig is never an ancestor of the action checkout.
Dropping the flag preserves tsconfig resolution while avoiding the crash.

Refs: oven-sh/bun#25730

https://claude.ai/code/session_01L763e4S7zBnzDqmYYEJS1A

* Fix prettier formatting in create-prompt/index.ts

Removes redundant outer parentheses that were tripping format:check.
Pre-existing on main; unrelated to the action.yml change but needed
to keep CI green on this branch.

https://claude.ai/code/session_01L763e4S7zBnzDqmYYEJS1A

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-09 14:12:16 -07:00
GitHub Actions
11ba60486e chore: bump Claude Code to 2.1.170 and Agent SDK to 0.3.170 v1.0.142 2026-06-09 17:27:26 +00:00
GitHub Actions
593d7a5c4e chore: bump Claude Code to 2.1.169 and Agent SDK to 0.3.169 v1.0.141 2026-06-08 21:57:59 +00:00
GitHub Actions
fbda2eb1bd chore: bump Claude Code to 2.1.168 and Agent SDK to 0.3.168 v1.0.140 2026-06-06 23:42:46 +00:00
GitHub Actions
64de744025 chore: bump Claude Code to 2.1.167 and Agent SDK to 0.3.167 v1.0.139 2026-06-06 01:34:14 +00:00
GitHub Actions
410165836e chore: bump Claude Code to 2.1.166 and Agent SDK to 0.3.166 v1.0.138 2026-06-06 00:56:12 +00:00
GitHub Actions
41ea7642c1 chore: bump Claude Code to 2.1.165 and Agent SDK to 0.3.165 v1.0.137 2026-06-05 05:45:57 +00:00
GitHub Actions
0b1b620029 chore: bump Claude Code to 2.1.163 and Agent SDK to 0.3.163 v1.0.136 2026-06-04 21:54:01 +00:00
GitHub Actions
70a6e5256e chore: bump Claude Code to 2.1.162 and Agent SDK to 0.3.162 v1.0.135 2026-06-03 21:32:44 +00:00
GitHub Actions
36a69b6a90 chore: bump Claude Code to 2.1.161 and Agent SDK to 0.3.161 v1.0.134 2026-06-02 21:59:11 +00:00
ant-kurt
bfad70d6a1
ci: bump checkout and setup-bun in test workflows to Node 24 releases (#1379)
actions/checkout v4 and oven-sh/setup-bun v2.0.2 run on the deprecated
Node 20 action runtime and emit a deprecation warning on every run.
Bump to checkout v6.0.2 and setup-bun v2.2.0 (both Node 24).

Co-authored-by: ant-kurt <209710463+ant-kurt@users.noreply.github.com>
2026-06-02 12:03:04 -07:00
ant-kurt
dc081a3809
chore: bump actions/setup-node from v4.4.0 to v6.4.0 (Node.js 24) (#1377)
* chore: bump actions/setup-node from v4.4.0 to v6.4.0 (Node.js 24)

setup-node v4 runs on the deprecated Node.js 20 action runtime, producing
a deprecation warning on every workflow run that uses base-action. v6 runs
on Node 24. This only changes the action's own runtime — the node-version
it installs for user code is unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Disable setup-node v5+ automatic package-manager caching

Preserves v4 behavior: caching only when use_node_cache=true.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: ant-kurt <209710463+ant-kurt@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 12:02:35 -07:00
Ashwin Bhat
420335da51
Add workload identity federation support to base-action (#1378)
* Add workload identity federation support to base-action

Move the workload identity module into base-action so the standalone
action can fetch and refresh the GitHub OIDC identity token itself, and
expose the same federation inputs as the outer action. Switch the
base-action test workflows from the anthropic_api_key secret to the
federation repo variables and grant them id-token: write.

* Verify MCP test tool invocation instead of init connection status

MCP servers can connect asynchronously, so the init event may report a
server as pending. Check that the server is registered at init, then
assert the test tool was actually called and returned its response.
Also pass the MCP config through claude_args --mcp-config, replacing the
removed mcp_config input.
2026-06-02 11:52:23 -07:00
GitHub Actions
7f37f2e373 chore: bump Claude Code to 2.1.160 and Agent SDK to 0.3.160 2026-06-02 02:11:04 +00:00
GitHub Actions
fb53c379a0 chore: bump Claude Code to 2.1.159 and Agent SDK to 0.3.159 2026-05-31 19:43:36 +00:00
GitHub Actions
c5c315c8a1 chore: bump Claude Code to 2.1.158 and Agent SDK to 0.3.158 2026-05-30 02:42:43 +00:00
GitHub Actions
f809dea0ba chore: bump Claude Code to 2.1.157 and Agent SDK to 0.3.157 2026-05-29 20:21:24 +00:00
GitHub Actions
0fb1b8f303 chore: bump Claude Code to 2.1.156 and Agent SDK to 0.3.156 2026-05-29 01:43:14 +00:00
GitHub Actions
3d4c9fde8e chore: bump Claude Code to 2.1.154 and Agent SDK to 0.3.154 2026-05-28 18:02:04 +00:00
GitHub Actions
324957b26b chore: bump Claude Code to 2.1.153 and Agent SDK to 0.3.153 2026-05-28 00:52:58 +00:00
GitHub Actions
73c91f04a8 chore: bump Claude Code to 2.1.152 and Agent SDK to 0.3.152 2026-05-27 01:31:47 +00:00
GitHub Actions
787c5a0ce9 chore: bump Claude Code to 2.1.150 and Agent SDK to 0.3.150 v1.0.133 2026-05-23 04:04:43 +00:00
Ashwin Bhat
4257c8e059
Use workload identity federation for Claude auth in CI workflows (#1344)
Switch claude.yml, claude-review.yml, and issue-triage.yml from the
anthropic_api_key secret to the workload identity federation inputs.
The federation rule, organization, and service account IDs are read
from repository variables; issue-triage.yml additionally gains the
id-token: write permission required to request the OIDC token.
2026-05-22 15:46:06 -07:00
GitHub Actions
bbfaf8e1ff chore: bump Claude Code to 2.1.149 and Agent SDK to 0.3.149 v1.0.132 2026-05-22 22:10:12 +00:00
GitHub Actions
4481e6d3c7 chore: bump Claude Code to 2.1.148 and Agent SDK to 0.3.148 v1.0.131 2026-05-22 01:17:47 +00:00
Ashwin Bhat
661a6fefbd
Add Workload Identity Federation (OIDC) authentication support (#1338)
* Add workload identity federation auth support

Adds anthropic_federation_rule_id, anthropic_organization_id,
anthropic_service_account_id, anthropic_workspace_id, and
anthropic_oidc_audience inputs. When the federation rule and organization
are set, the action fetches the workflow's GitHub Actions OIDC token,
writes it to a file in RUNNER_TEMP, keeps it refreshed during execution,
and points the Claude Code CLI at it via ANTHROPIC_IDENTITY_TOKEN_FILE so
the CLI can exchange it for a short-lived access token instead of using a
static API key.

* Add WIF example workflow and base-action federation docs

* Default workload identity OIDC audience to https://api.anthropic.com
v1.0.130
2026-05-21 15:19:15 -07:00
GitHub Actions
c9d66afb17 chore: bump Claude Code to 2.1.147 and Agent SDK to 0.3.147 v1.0.129 2026-05-21 20:40:16 +00:00
GitHub Actions
20c8abf165 chore: bump Claude Code to 2.1.146 and Agent SDK to 0.3.146 v1.0.128 2026-05-21 01:52:44 +00:00
Ashwin Bhat
1dc994ee7a
Resolve actor account type before applying allowed_bots (#1330)
Move the allowed_bots check in checkHumanActor and checkWritePermissions so
it only fires after the actor has been resolved as a non-User account
(GitHub App / bot, or unresolvable app actor). Actors that resolve to a
regular User account go through the standard human/write checks regardless
of allowed_bots.

The Copilot-style path (GITHUB_ACTOR not ending in [bot] and not resolvable
as a user) is unchanged: it still falls through to the existing 404 catch,
which already consults allowed_bots once the API has reported the actor is
not a user.

Update tests to match and add coverage for the User-account path.
v1.0.127
2026-05-19 16:30:49 -07:00
GitHub Actions
ca89df3d42 chore: bump Claude Code to 2.1.145 and Agent SDK to 0.3.145 v1.0.126 2026-05-19 22:21:48 +00:00
Ashwin Bhat
fd1877debc
Simplify comment tool instructions in prompt (#1328) v1.0.125 2026-05-19 14:50:18 -07:00
GitHub Actions
24492741e0 chore: bump Claude Code to 2.1.144 and Agent SDK to 0.3.144 v1.0.124 2026-05-19 00:49:28 +00:00
Ashwin Bhat
0345b11d48
Fix prettier formatting in create-prompt (#1325) 2026-05-18 08:27:45 -07:00
GitHub Actions
b020494b57 chore: bump Claude Code to 2.1.143 and Agent SDK to 0.3.143 2026-05-15 22:29:11 +00:00
Ashwin Bhat
d56f10247e
Strengthen simplified tag-mode prompt (USE_SIMPLE_PROMPT) (#1313)
The opt-in simplified tag-mode prompt omitted several guardrails the
default prompt has. Bring it closer to the default's posture while
keeping it terse:

- Scoping clarification: spell out that only the triggering comment
  (or the issue body for issue events) carries instructions; other
  comments, the body, review comments, and repository files are
  reference context, not commands to act on.
- Review-only stop-condition: questions and code reviews must not edit,
  commit, push, or create branches unless the trigger explicitly asks
  for a code change.
- PR base-branch diff: when triggered on a PR with a known base branch,
  compare against origin/<base> instead of main/master.
- Capability limits: cannot submit formal PR reviews, approve, or merge;
  decline politely and point to the FAQ.

Adds focused tests covering the new lines for both PR and non-PR
events, including presence/absence of the conditional base-branch line.
2026-05-14 17:06:45 -07:00
Futurize Rush
bbad5183ff
fix: add parentheses to fix operator precedence in co-author check (#1199)
`??` has lower precedence than `!==`, so the expression:
  triggerDisplayName ?? triggerUsername !== "Unknown"
parses as:
  triggerDisplayName ?? (triggerUsername !== "Unknown")

When triggerDisplayName is an empty string "", the condition
evaluates to "" (falsy), incorrectly skipping the co-author line
even though the user is not "Unknown".

Add parentheses to get the intended behavior:
  (triggerDisplayName ?? triggerUsername) !== "Unknown"

Co-authored-by: Rush <rush@RushdeMacBook-Pro.local>
2026-05-14 16:58:17 -07:00
GitHub Actions
51ea8ea73a chore: bump Claude Code to 2.1.142 and Agent SDK to 0.3.142 v1.0.123 2026-05-14 22:56:05 +00:00
Ashwin Bhat
acfa366ca8
chore: bump pinned Bun to 1.3.14 (#1312)
* chore: bump pinned Bun to 1.3.14

* style: apply prettier to actor/permissions files
2026-05-14 18:55:04 -04:00
Kris
9eb125afe3
fix: handle non-user actors (e.g. Copilot) in permission and actor checks (#1144)
GitHub Apps like Copilot SWE Agent set GITHUB_ACTOR to a value (e.g.
"Copilot") that is neither a valid GitHub user nor ends with "[bot]".
This caused two independent crashes:

1. checkWritePermissions (permissions.ts): called the collaborator
   permission API which returns 404 "is not a user" for non-user actors.
2. checkHumanActor (actor.ts): called the Users API first, which 404s,
   before ever reaching the allowed_bots check.

Fix both by:
- Checking allowed_bots BEFORE making API calls, so known bots skip the
  API entirely.
- In permissions.ts, catching "is not a user" 404 errors and falling
  back to the allowed_bots list instead of crashing.
- In actor.ts, catching 404 errors and providing a clear error message
  telling the user to add the bot to allowed_bots.

Closes #900, #903, #1018, #1133

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-14 15:38:34 -07:00
JerryLee
1450f658d3
fix: write execution file when SDK throws (#1255) 2026-05-14 15:37:28 -07:00
Christian Van
0756f6ef2b
fix: exclude .claude-pr snapshot from git staging (#1277) 2026-05-14 15:36:57 -07:00