Compare commits

..
66 Commits
Author SHA1 Message Date
GitHub Actions 8041f1d17e chore: bump Claude Code to 2.1.311 and Agent SDK to 0.3.311 2026-10-26 21:53:19 +00:00
925afb5377 chore: bump Bun to 1.4.4 (#1916)
Pin oven-sh/setup-bun to Bun 1.4.4 in action.yml, base-action/action.yml
and the CI workflow (the prettier job previously floated on latest), and
update @types/bun to 1.4.3, the newest published types, in both packages.

Co-authored-by: GitHub Actions <[email protected]>
2026-10-24 00:45:41 +00:00
GitHub Actions 16f9f71ab9 chore: bump Claude Code to 2.1.310 and Agent SDK to 0.3.310 2026-10-23 23:40:57 +00:00
Octavian GuzuandGitHub 8d70a0dd26 Pin the PR version a run checks out (#1915)
Squash merge of 2 commits
2026-10-23 09:26:23 -07:00
GitHub Actions ae68417a74 chore: bump Claude Code to 2.1.309 and Agent SDK to 0.3.309 2026-10-22 22:20:35 +00:00
GitHub Actions 6b6870e649 chore: bump Claude Code to 2.1.308 and Agent SDK to 0.3.308 2026-10-22 04:36:28 +00:00
GitHub Actions aa8a7738e4 chore: bump Claude Code to 2.1.307 and Agent SDK to 0.3.307 2026-10-21 22:19:04 +00:00
GitHub Actions a5a423f75c chore: bump Claude Code to 2.1.306 and Agent SDK to 0.3.306 2026-10-21 03:18:30 +00:00
GitHub Actions e4a6faad49 chore: bump Claude Code to 2.1.305 and Agent SDK to 0.3.305 2026-10-20 20:48:51 +00:00
GitHub Actions db77d4d3c9 chore: bump Claude Code to 2.1.304 and Agent SDK to 0.3.304 2026-10-19 21:37:01 +00:00
GitHub Actions 5eb090f3c3 chore: bump Claude Code to 2.1.303 and Agent SDK to 0.3.303 2026-10-18 22:29:02 +00:00
GitHub Actions f27be6b65a chore: bump Claude Code to 2.1.302 and Agent SDK to 0.3.302 2026-10-16 20:54:52 +00:00
GitHub Actions 374f254f5e chore: bump Claude Code to 2.1.301 and Agent SDK to 0.3.301 2026-10-15 19:24:46 +00:00
GitHub Actions a26b07d8c7 chore: bump Claude Code to 2.1.300 and Agent SDK to 0.3.300 2026-10-14 18:27:27 +00:00
GitHub Actions 34968b5981 chore: bump Claude Code to 2.1.299 and Agent SDK to 0.3.299 2026-10-14 02:51:42 +00:00
GitHub Actions 1d6de8cb0c chore: bump Claude Code to 2.1.296 and Agent SDK to 0.3.296 2026-10-09 19:32:29 +00:00
GitHub Actions 2dca132ff0 chore: bump Claude Code to 2.1.295 and Agent SDK to 0.3.295 2026-10-08 19:51:21 +00:00
GitHub Actions 38c80c1a32 chore: bump Claude Code to 2.1.294 and Agent SDK to 0.3.294 2026-10-08 17:21:17 +00:00
GitHub Actions 6fed3ca145 chore: bump Claude Code to 2.1.293 and Agent SDK to 0.3.293 2026-10-07 18:13:38 +00:00
GitHub Actions 58985842b8 chore: bump Claude Code to 2.1.292 and Agent SDK to 0.3.292 2026-10-06 19:02:41 +00:00
GitHub Actions 86d88e619d chore: bump Claude Code to 2.1.291 and Agent SDK to 0.3.291 2026-10-06 03:57:41 +00:00
GitHub Actions 6c690188da chore: bump Claude Code to 2.1.290 and Agent SDK to 0.3.290 2026-10-05 23:35:40 +00:00
GitHub Actions cab360f656 chore: bump Claude Code to 2.1.289 and Agent SDK to 0.3.289 2026-10-03 23:10:04 +00:00
GitHub Actions ed670b4cf9 chore: bump Claude Code to 2.1.288 and Agent SDK to 0.3.288 2026-10-02 20:23:19 +00:00
GitHub Actions 97c5347339 chore: bump Claude Code to 2.1.287 and Agent SDK to 0.3.287 2026-10-01 18:01:56 +00:00
GitHub Actions 12dd8d74c7 chore: bump Claude Code to 2.1.286 and Agent SDK to 0.3.286 2026-09-30 19:10:48 +00:00
a8cb0db4d8 ci: security hardening for GitHub Actions workflows that call Claude (#1867)
* Run workflows that call Claude on the egress-firewall runner in auto permission mode

Move every workflow job that signs in to the Claude API from
ubuntu-latest to GitHub's egress-firewall runner (ubuntu-24.04-firewall),
and pass --permission-mode auto to the Claude Code action in each of
them except claude.yml.

In auto permission mode Claude Code reviews each tool call that needs
permission and that the allowed tools do not cover, and runs it only if
Claude Code's safety review passes it. Until now these runs, which have nobody to
ask, refused every such call. The issue triage step, which anyone can
start by opening an issue, also passes a --disallowedTools list for
tools it never needs.

claude.yml answers @claude mentions, and for those the action sets
--permission-mode acceptEdits itself. Its permission mode is unchanged.

Allowed tools, settings, models, triggers and permissions are unchanged.
The network allow list for the firewall follows in the next change.

* Add the network allow list, a security check and CLAUDE.md guidance

- .github/egress-firewall.yaml: the hosts that jobs on the
  egress-firewall runner may reach, in enforce mode, each with what
  uses it.
- .github/workflows/workflow-hardening.yml and
  .github/scripts/check_workflow_hardening.py: a check that fails when a
  job that calls Claude is not on the egress-firewall runner, does not
  pass --permission-mode auto, or when the allow list is missing, empty, not in
  enforce mode or names a host with '*'.
  claude.yml is listed as exempt from the permission mode rule, with
  the reason.
- CLAUDE.md: a "Security hardening for GitHub Actions" section so that
  new and edited workflows keep these protections.

* Pin the model for issue triage

The step named no model, so it ran on Claude Code's default model. That
default changed with Claude Code 2.1.280 to a model that is not available
to this CI account. Pass --model claude-opus-5, the model this repository's test-*.yml
workflows (ANTHROPIC_MODEL) and the Python SDK's example runs are
pinned to for the same reason.

This is independent of the security hardening in the two changes before
it.

* Check settings files and --settings for a permission mode

The security check looked for defaultMode only in an inline 'settings'
input. Also read the file a 'settings' input or a --settings flag in
claude_args names, when it is inside the repository, and fail if it sets
a permission mode.

* Flag defaultMode anywhere in a job that calls Claude

A settings file that an earlier step writes at run time can't be read by
the step-level check, so also fail when the job's definition mentions
defaultMode at all.

* Fail the check when settings name a file outside the repository

The check can't read such a file, so it can't tell whether it sets a
permission mode.

* Run @claude mentions in auto permission mode

The action sets --permission-mode acceptEdits for @claude mentions and
appends the workflow's claude_args after it, so the --permission-mode auto
in claude.yml wins. Drop claude.yml from EXEMPT_FROM_AUTO_MODE.

The check now also fails when a step in auto mode names a model older than
claude-opus-4-6: Claude Code does not run auto mode on those and falls back
to its default permission mode.

---------

Co-authored-by: Claude <[email protected]>
2026-09-30 06:33:49 +00:00
GitHub Actions fd1c128679 chore: bump Claude Code to 2.1.285 and Agent SDK to 0.3.285 2026-09-29 19:29:07 +00:00
GitHub Actions 8ce9314fa9 chore: bump Claude Code to 2.1.284 and Agent SDK to 0.3.284 2026-09-28 18:04:13 +00:00
GitHub Actions 756cc22e19 chore: bump Claude Code to 2.1.283 and Agent SDK to 0.3.283 2026-09-25 21:50:53 +00:00
GitHub Actions 9171db3e57 chore: bump Claude Code to 2.1.282 and Agent SDK to 0.3.282 2026-09-24 20:26:46 +00:00
GitHub Actions 8cf3482550 chore: bump Claude Code to 2.1.281 and Agent SDK to 0.3.281 2026-09-23 19:39:47 +00:00
46a42b4323 ci: pin the integration tests to claude-opus-5 (#1853)
The test workflows name no model, so they run on the Claude Code CLI's
default model. Since the bump to Claude Code 2.1.280 that default is Opus 5.5,
which the CI account's API access refuses, so the tests fail and the release
job never runs. Setting ANTHROPIC_MODEL at the workflow level keeps the tests
independent of the CLI's default model, the same fix the Agent SDK for Python
used.

Co-authored-by: Claude Code <[email protected]>
2026-09-23 09:39:39 -07:00
GitHub Actions 9ca9355b36 chore: bump Claude Code to 2.1.280 and Agent SDK to 0.3.280 2026-09-22 16:39:34 +00:00
GitHub Actions cfc3eb22bf chore: bump Claude Code to 2.1.278 and Agent SDK to 0.3.278 2026-09-19 03:11:10 +00:00
GitHub Actions 4036a180cf chore: bump Claude Code to 2.1.277 and Agent SDK to 0.3.277 2026-09-18 18:07:24 +00:00
GitHub Actions a4f54ef2c5 chore: bump Claude Code to 2.1.276 and Agent SDK to 0.3.276 2026-09-18 02:13:13 +00:00
GitHub Actions 2261fcfc88 chore: bump Claude Code to 2.1.275 and Agent SDK to 0.3.275 2026-09-17 22:33:23 +00:00
GitHub Actions 3b8197d3d4 chore: bump Claude Code to 2.1.274 and Agent SDK to 0.3.274 2026-09-17 00:12:40 +00:00
GitHub Actions 7b0b255830 chore: bump Claude Code to 2.1.273 and Agent SDK to 0.3.273 2026-09-15 20:23:44 +00:00
GitHub Actions bf38e86e58 chore: bump Claude Code to 2.1.272 and Agent SDK to 0.3.272 2026-09-15 00:43:27 +00:00
GitHub Actions 51db78a4b8 chore: bump Claude Code to 2.1.271 and Agent SDK to 0.3.271 2026-09-14 22:13:27 +00:00
GitHub Actions 9cdae7f0d9 chore: bump Claude Code to 2.1.270 and Agent SDK to 0.3.270 2026-09-12 19:46:49 +00:00
GitHub Actions 56cf60fde4 chore: bump Claude Code to 2.1.269 and Agent SDK to 0.3.269 2026-09-11 19:18:51 +00:00
GitHub Actions 0a8d3c9443 chore: bump Claude Code to 2.1.268 and Agent SDK to 0.3.268 2026-09-10 20:39:16 +00:00
GitHub Actions 19dda84776 chore: bump Claude Code to 2.1.267 and Agent SDK to 0.3.267 2026-09-09 20:11:01 +00:00
GitHub Actions 5ccc3a35a6 chore: bump Claude Code to 2.1.266 and Agent SDK to 0.3.266 2026-09-08 23:56:12 +00:00
GitHub Actions 0d0e0876d3 chore: bump Claude Code to 2.1.265 and Agent SDK to 0.3.265 2026-09-08 20:38:21 +00:00
GitHub Actions 9c5ddab2e6 chore: bump Claude Code to 2.1.263 and Agent SDK to 0.3.263 2026-09-06 02:55:18 +00:00
GitHub Actions d75b94d5ad chore: bump Claude Code to 2.1.261 and Agent SDK to 0.3.261 2026-09-04 19:58:53 +00:00
GitHub Actions ef8bb1e43b chore: bump Claude Code to 2.1.260 and Agent SDK to 0.3.260 2026-09-03 23:48:49 +00:00
GitHub Actions fa2b2666b7 chore: bump Claude Code to 2.1.259 and Agent SDK to 0.3.259 2026-09-02 22:34:41 +00:00
GitHub Actions 8251c103ac chore: bump Claude Code to 2.1.258 and Agent SDK to 0.3.258 2026-09-01 22:33:40 +00:00
GitHub Actions 781d62e9d5 chore: bump Claude Code to 2.1.257 and Agent SDK to 0.3.257 2026-09-01 17:54:28 +00:00
GitHub Actions 833fb0f8c9 chore: bump Claude Code to 2.1.252 and Agent SDK to 0.3.252 2026-08-31 19:47:59 +00:00
GitHub Actions a874e9ecd7 chore: bump Claude Code to 2.1.251 and Agent SDK to 0.3.251 2026-08-28 18:20:42 +00:00
GitHub Actions a60f3e1db3 chore: bump Claude Code to 2.1.250 and Agent SDK to 0.3.250 2026-08-28 00:50:11 +00:00
GitHub Actions e8c2d7c16c chore: bump Claude Code to 2.1.248 and Agent SDK to 0.3.248 2026-08-27 22:12:44 +00:00
GitHub Actions 70fec18385 chore: bump Claude Code to 2.1.247 and Agent SDK to 0.3.247 2026-08-27 00:09:24 +00:00
GitHub Actions 1f291e1cfe chore: bump Claude Code to 2.1.246 and Agent SDK to 0.3.246 2026-08-25 22:32:51 +00:00
Muhammad Abdullah khanandGitHub 76ac41a83e fix: encode branch names in GitHub links (#1713)
* fix: encode branch names in GitHub links

* style: format branch URL helper
2026-08-25 11:02:49 -07:00
Jeremy SchoemakerandGitHub 8ef9699156 fix: bound download_job_log against a stalled log fetch (#1719)
The download_job_log MCP tool called
client.actions.downloadJobLogsForWorkflowRun() with no timeout and no
AbortController. @octokit/rest@21 runs on Node's native fetch, which has
no default timeout, and Octokit only cancels a request when the caller
passes request.signal. If the log blob fetch stalls, that await never
resolves and never rejects.

This tool is always enabled in tag mode (src/modes/tag/index.ts), so a
"fix the failing CI" run that calls get_ci_status -> get_workflow_run_details
-> download_job_log can hang on this one await with nothing to recover it.
It's headless, so the run only ends when the Actions job-level
timeout-minutes kills it, burning the whole job budget with the tracking
comment stuck at "Claude Code is working...".

Sibling fetch in src/github/utils/image-downloader.ts (fetchImage) already
got this treatment in #1625 via a timeout-driven AbortController. Same
shape of call: fetch a GitHub-hosted resource by ID from untrusted PR/CI
content. This mirrors that fix for github-actions-server.ts.

Extracted the download+write logic into an exported downloadJobLog()
function (with an injectable timeoutMs) so the timeout path is directly
testable, and guarded the module's entrypoint side effects with
import.meta.main, matching the pattern already used by the other
entrypoints in src/entrypoints/.
2026-08-25 08:46:02 -07:00
Yauheni PapovichandGitHub 791545dab1 fix: allow parentheses in valid branch names (#1710)
Accept parentheses while preserving existing branch-name security checks.

Add regression coverage for scoped branch names.

Refs anthropics/claude-code-action#1709
2026-08-25 08:45:50 -07:00
2d7a787fbd fix: use paths in delete_files prompt example (#1702)
* fix: use paths param in delete_files prompt example

The tag-mode prompt told the model to call delete_files with
"files", but the MCP tool schema and handler expect "paths".

Co-authored-by: Cursor <[email protected]>

* test: prove delete_files prompt against the live MCP schema

The old {files} payload is rejected by the same Zod shape the
tool registers; the generated prompt example now parses cleanly.

Co-authored-by: Cursor <[email protected]>

* test: cover delete_files schema edges and the sibling commit_files tool

Confirm the old files-only payload still fails, types and required
fields are enforced, and commit_files was not inverted by the fix.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: RESILIENCE Agentic Solutions <[email protected]>
Co-authored-by: Cursor <[email protected]>
2026-08-25 08:45:33 -07:00
Mohammed AlkindiandGitHub b58c16b325 chore: add .gitattributes to normalize line endings (#1708)
On Windows, git's default core.autocrlf=true checks out CRLF, and the contributor commands in CONTRIBUTING.md then fail: bun run format:check reports 191 files because Prettier defaults to endOfLine "lf", and three tests that match LF-terminated content fail.

All tracked blobs are already LF, so this changes checkout behavior only and produces no renormalization diff. Every CI job runs on ubuntu-latest, where it is a no-op.
2026-08-25 08:45:13 -07:00
GitHub Actions 16b3b310c3 chore: bump Claude Code to 2.1.245 and Agent SDK to 0.3.245 2026-08-25 05:14:05 +00:00
36 changed files with 1023 additions and 153 deletions
+3
View File
@@ -0,0 +1,3 @@
# Keep the working tree LF on every platform: Prettier defaults to
# endOfLine "lf" and several tests match LF-terminated content.
* text=auto eol=lf
+29
View File
@@ -0,0 +1,29 @@
# Hosts that jobs on GitHub's egress-firewall runner (runs-on: ubuntu-24.04-firewall)
# may reach. All other hosts are blocked, apart from any that GitHub's firewall allows
# by default. Add a host only when a workflow step needs it, name it in full (no '*'), and say what uses it.
mode: enforce
allow:
# Claude API: model requests, trading the workflow's GitHub identity token for a
# short-lived API token, and fetching the Claude GitHub App's token in claude.yml and
# claude-review.yml
- api.anthropic.com
# GitHub API: calls made by the Claude Code action, by gh in scripts/gh.sh and
# scripts/edit-issue-labels.sh, and by the /review-pr command
- api.github.com
# Claude Code install script: fetched by the Claude Code action, and by
# test-custom-executables.yml ("Install Claude Code manually")
- claude.ai
# Claude Code binary, downloaded by the install script
- downloads.claude.ai
# Bun and Node.js release downloads (oven-sh/setup-bun and actions/setup-node)
- release-assets.githubusercontent.com
# npm packages (bun install in action.yml, base-action/action.yml and
# test-mcp-servers.yml)
- registry.npmjs.org
# Bun install script (test-custom-executables.yml, "Install Bun manually")
- bun.sh
# apt packages bubblewrap and socat, which the Claude Code action installs when a
# workflow admits users without write access (issue-triage.yml)
- azure.archive.ubuntu.com
- archive.ubuntu.com
- security.ubuntu.com
+339
View File
@@ -0,0 +1,339 @@
#!/usr/bin/env python3
"""Fail if a workflow job that calls Claude, or .github/egress-firewall.yaml, breaks a rule in CLAUDE.md,
"Security hardening for GitHub Actions". Run from the repository root. A job calls Claude when it runs the
Claude Code action, or when it or a local action it uses mentions ANTHROPIC_FEDERATION_RULE_ID.
"""
import json
import pathlib
import re
import shlex
import subprocess
import sys
FIREWALL_RUNNER = "ubuntu-24.04-firewall"
WORKFLOW_DIR = pathlib.Path(".github/workflows")
POLICY_PATH = pathlib.Path(".github/egress-firewall.yaml")
SIGN_IN_MARKER = "anthropic_federation_rule_id"
CLAUDE_ACTIONS = ("anthropics/claude-code-action", "anthropics/claude-code-base-action")
HELP = 'See CLAUDE.md, "Security hardening for GitHub Actions".'
# Claude Code runs auto mode only on claude-opus-4-6 and newer models. On an older model it
# falls back to its default permission mode, with no safety review.
AUTO_MODE_MIN_VERSION = (4, 6)
# The version in a model name: claude-opus-4-6, claude-sonnet-4-5-20250929, claude-3-5-sonnet-latest.
MODEL_VERSION = re.compile(
r"claude-(?:(?:opus|sonnet|haiku)-(\d+)(?:-(\d{1,2}))?"
r"|(\d+)(?:-(\d{1,2}))?-(?:opus|sonnet|haiku))(?![\d.])"
)
# Key: "<workflow file name>:<job id>". Value: why that job is exempt from the table's rule.
EXEMPT_FROM_FIREWALL_RUNNER: dict[str, str] = {}
EXEMPT_FROM_AUTO_MODE: dict[str, str] = {}
def stop(message: str):
sys.exit(f"::error::{message}")
def load_yaml(path: pathlib.Path):
"""Parse a YAML file with PyYAML, or with the yq command if PyYAML is absent."""
try:
import yaml
except ImportError:
try:
result = subprocess.run(
["yq", "-o=json", ".", str(path)], check=True, capture_output=True, text=True
)
except FileNotFoundError:
stop(
f"Cannot read {path}: Python has no 'yaml' module and no 'yq' command was found. "
"Add a step that runs 'pip install pyyaml' before this check."
)
except subprocess.CalledProcessError:
stop(f"Cannot read {path}: 'yq' could not parse it. Check that the file is valid YAML.")
return json.loads(result.stdout)
try:
with path.open(encoding="utf-8") as handle:
return yaml.safe_load(handle)
except yaml.YAMLError as error:
stop(f"Cannot read {path}: it is not valid YAML ({error}).")
def contains_marker(node) -> bool:
"""Whether any key or string under node contains SIGN_IN_MARKER, ignoring case."""
if isinstance(node, dict):
return any(contains_marker(k) or contains_marker(v) for k, v in node.items())
if isinstance(node, list):
return any(contains_marker(item) for item in node)
return isinstance(node, str) and SIGN_IN_MARKER in node.lower()
def load_local_action(uses: str):
"""The parsed action file of a local action (uses: ./path), or None."""
if not uses.startswith("./"):
return None
for name in ("action.yml", "action.yaml"):
action_file = pathlib.Path(uses) / name
if action_file.is_file():
action = load_yaml(action_file)
return action if isinstance(action, dict) else {}
return None
def steps_of(job: dict) -> list[dict]:
return [step for step in job.get("steps") or [] if isinstance(step, dict)]
def runs_claude_code_action(step: dict) -> bool:
"""Whether the step runs the Claude Code action: the published action, or a
local action that accepts a claude_args input."""
uses = str(step.get("uses", ""))
if uses.lower().startswith(CLAUDE_ACTIONS):
return True
action = load_local_action(uses)
return action is not None and "claude_args" in (action.get("inputs") or {})
def job_calls_claude(job: dict) -> bool:
if contains_marker(job):
return True
for step in steps_of(job):
if runs_claude_code_action(step):
return True
action = load_local_action(str(step.get("uses", "")))
if action is not None and contains_marker(action):
return True
return False
def permission_mode_problem(step: dict, exempt: bool, inherited_env: dict) -> str | None:
"""The message for a step whose permission mode is wrong, or None if it is right.
A step must set auto mode, on a model that supports it. A step of a job in
EXEMPT_FROM_AUTO_MODE must set no mode at all. inherited_env is the workflow's and the
job's 'env'.
"""
inputs = step.get("with") or {}
lines = str(inputs.get("claude_args", "")).splitlines()
text = " ".join(line for line in lines if not line.strip().startswith("#"))
try:
args = shlex.split(text, comments=True)
except ValueError:
return "'claude_args' has a quote that is never closed. Close it"
modes = []
for index, arg in enumerate(args):
if arg == "--dangerously-skip-permissions":
return (
"remove '--dangerously-skip-permissions' from 'claude_args': "
"it turns off permission checks"
)
if arg == "--permission-mode":
modes.append(args[index + 1] if index + 1 < len(args) else "")
elif arg.startswith("--permission-mode="):
modes.append(arg.split("=", 1)[1])
if exempt and modes:
return (
"remove '--permission-mode' from 'claude_args': this job is listed in "
"EXEMPT_FROM_AUTO_MODE (.github/scripts/check_workflow_hardening.py), and a job listed "
"there must not set a permission mode"
)
if not modes and not exempt:
return "add '--permission-mode auto' to 'claude_args' under the step's 'with:'"
for mode in modes:
if mode == "":
return (
"'claude_args' has '--permission-mode' with nothing after it. "
"Write '--permission-mode auto'"
)
if mode != "auto":
return (
f"'claude_args' has '--permission-mode {mode}'. "
"Change it to '--permission-mode auto'"
)
env = {**inherited_env, **(step.get("env") or {})}
models = [
("the step's 'model'", inputs.get("model", "")),
("ANTHROPIC_MODEL", env.get("ANTHROPIC_MODEL", "")),
]
models += [
(f"'{flag}' in 'claude_args'", value)
for flag in ("--model", "--fallback-model")
for value in flag_values(args, flag)
]
settings = [("the step's 'settings'", inputs.get("settings", ""))]
settings += [
("'--settings' in 'claude_args'", value) for value in flag_values(args, "--settings")
]
for where, value in settings:
text = settings_text(value)
if text is None:
return (
f"{where} names a file outside the repository, which this check cannot read. "
"Use inline settings or a file inside the repository"
)
if "defaultMode" in text:
return f"remove 'defaultMode' from {where}: settings must not set a permission mode"
try:
parsed = json.loads(text) if text else {}
except ValueError:
parsed = {}
if isinstance(parsed, dict) and "model" in parsed:
models.append((f"'model' in {where}", parsed["model"]))
if not exempt:
for where, model in models:
if predates_auto_mode(str(model or "")):
return (
f"{where} is '{model}', which Claude Code does not run in auto mode: it "
"falls back to the default permission mode. Use claude-opus-4-6 or a newer model"
)
return None
def flag_values(args: list[str], flag: str) -> list[str]:
"""The values a flag in claude_args is given, as '--flag value' or '--flag=value'."""
values = [
args[index + 1] for index, arg in enumerate(args) if arg == flag and index + 1 < len(args)
]
return values + [arg.split("=", 1)[1] for arg in args if arg.startswith(f"{flag}=")]
def predates_auto_mode(model: str) -> bool:
"""Whether the model is older than AUTO_MODE_MIN_VERSION. A name with no version, such as
'opus' or 'default', stands for a current model, except 'haiku' (claude-haiku-4-5)."""
if model.strip().lower() == "haiku":
return True
match = MODEL_VERSION.search(model.lower())
if not match:
return False
major, minor = match.group(1, 2) if match.group(1) else match.group(3, 4)
return (int(major), int(minor or 0)) < AUTO_MODE_MIN_VERSION
def settings_text(value) -> str | None:
"""The settings JSON a 'settings' value stands for: the value itself, or the contents of
the file it names when it is a path inside the repository. None when it names a path
outside the repository."""
text = str(value or "").strip()
if not text or text.startswith("{"):
return text
path = pathlib.Path(text)
root = pathlib.Path.cwd().resolve()
try:
resolved = path.resolve()
resolved.relative_to(root)
except (OSError, ValueError):
return None
if resolved.is_file():
return resolved.read_text(encoding="utf-8", errors="replace")
return text
def check_job(file_name: str, job_id: str, job: dict, workflow_env: dict) -> list[str]:
key = f"{file_name}:{job_id}"
where = f".github/workflows/{file_name}: job '{job_id}'"
errors = []
runs_on = job.get("runs-on")
if isinstance(runs_on, list) and len(runs_on) == 1:
runs_on = runs_on[0]
if key in EXEMPT_FROM_FIREWALL_RUNNER:
print(
f"The egress-firewall runner is not required for job '{job_id}' in {file_name}. "
f"Reason: {EXEMPT_FROM_FIREWALL_RUNNER[key]}."
)
elif runs_on != FIREWALL_RUNNER:
if "runs-on" not in job:
has = "no 'runs-on'"
elif isinstance(job["runs-on"], str):
has = f"'runs-on: {job['runs-on']}'"
else:
has = "a 'runs-on' list or group"
errors.append(
f"{where} calls Claude, so it must have 'runs-on: {FIREWALL_RUNNER}'. "
f"It has {has}. {HELP}"
)
exempt = key in EXEMPT_FROM_AUTO_MODE
if exempt:
print(
f"Auto permission mode is not required for job '{job_id}' in {file_name}. "
f"Reason: {EXEMPT_FROM_AUTO_MODE[key]}."
)
if "defaultMode" in json.dumps(job):
# Catches a settings file that an earlier step of the job writes, which the
# step-level check cannot read.
errors.append(
f"{where} mentions 'defaultMode': settings must not set a permission mode. {HELP}"
)
for index, step in enumerate(steps_of(job), start=1):
if not runs_claude_code_action(step):
continue
inherited_env = {**workflow_env, **(job.get("env") or {})}
problem = permission_mode_problem(step, exempt, inherited_env)
if problem:
step_label = f"step '{step['name']}'" if "name" in step else f"step {index}"
errors.append(f"{where}, {step_label}: {problem}. {HELP}")
return errors
def check_policy() -> list[str]:
if not POLICY_PATH.is_file():
return [
f"{POLICY_PATH} is missing. Jobs on the egress-firewall runner need it "
f"to limit outbound network access. {HELP}"
]
policy = load_yaml(POLICY_PATH)
if not isinstance(policy, dict):
return [
f"{POLICY_PATH} is empty or is not a set of 'name: value' lines. It needs 'mode: enforce' "
f"and an 'allow:' list of hosts. {HELP}"
]
errors = []
if "mode" not in policy:
errors.append(f"{POLICY_PATH}: 'mode' is missing. Add 'mode: enforce'. {HELP}")
elif policy["mode"] != "enforce":
errors.append(
f"{POLICY_PATH}: 'mode' is '{policy['mode']}'. It must be 'enforce'. {HELP}"
)
allow = policy.get("allow")
if not isinstance(allow, list) or not allow:
errors.append(
f"{POLICY_PATH}: the 'allow' list is missing or empty. List under 'allow:' "
f"each host the jobs need. {HELP}"
)
else:
for host in allow:
if "*" in str(host):
errors.append(
f"{POLICY_PATH}: the 'allow' entry '{host}' contains '*'. "
f"Name each host in full. {HELP}"
)
return errors
def main() -> int:
if not WORKFLOW_DIR.is_dir():
stop(f"{WORKFLOW_DIR} not found. Run this check from the repository root.")
errors = []
checked = 0
for path in sorted([*WORKFLOW_DIR.glob("*.yml"), *WORKFLOW_DIR.glob("*.yaml")]):
workflow = load_yaml(path)
jobs = workflow.get("jobs") if isinstance(workflow, dict) else None
for job_id, job in (jobs or {}).items():
if not isinstance(job, dict) or not job_calls_claude(job):
continue
checked += 1
errors.extend(check_job(path.name, job_id, job, workflow.get("env") or {}))
if checked:
errors.extend(check_policy())
for error in errors:
print(f"::error::{error}")
if errors:
return 1
if checked == 0:
print("OK: no workflow job calls Claude, so there was nothing to check.")
else:
print(f"OK: checked {checked} job(s) that call Claude and found no problems.")
return 0
if __name__ == "__main__":
sys.exit(main())
+4 -4
View File
@@ -12,7 +12,7 @@ jobs:
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.12
bun-version: 1.4.4
- name: Install dependencies
run: bun install
@@ -25,9 +25,9 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v1
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
bun-version: 1.4.4
- name: Install dependencies
run: bun install
@@ -42,7 +42,7 @@ jobs:
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.12
bun-version: 1.4.4
- name: Install dependencies
run: bun install
+7 -1
View File
@@ -8,7 +8,9 @@ jobs:
review:
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
# This job calls Claude, so it runs on GitHub's egress-firewall runner, which
# filters the job's outbound network traffic (allow list: .github/egress-firewall.yaml).
runs-on: ubuntu-24.04-firewall
permissions:
contents: read
pull-requests: write
@@ -30,6 +32,10 @@ jobs:
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
prompt: "/review-pr REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }}"
# --permission-mode auto: a tool call that needs permission and is outside --allowedTools
# below and the allowed-tools list in .claude/commands/review-pr.md runs only if Claude
# Code's safety review passes it.
claude_args: |
--permission-mode auto
--allowedTools "mcp__github_inline_comment__create_inline_comment"
--model "claude-opus-4-7"
+7 -1
View File
@@ -17,7 +17,9 @@ jobs:
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
# This job calls Claude, so it runs on GitHub's egress-firewall runner, which
# filters the job's outbound network traffic (allow list: .github/egress-firewall.yaml).
runs-on: ubuntu-24.04-firewall
permissions:
contents: write
pull-requests: write
@@ -39,6 +41,10 @@ jobs:
anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
# --permission-mode auto: a tool call that needs permission and that the allowed tools
# do not cover runs only if Claude Code's safety review passes it. The action sets
# --permission-mode acceptEdits for @claude mentions, and this one, which comes after it, wins.
claude_args: |
--allowedTools "Bash(bun install),Bash(bun test:*),Bash(bun run format),Bash(bun typecheck)"
--model "claude-opus-4-7"
--permission-mode auto
+7 -1
View File
@@ -6,7 +6,9 @@ on:
jobs:
triage-issue:
runs-on: ubuntu-latest
# This job calls Claude, so it runs on GitHub's egress-firewall runner, which
# filters the job's outbound network traffic (allow list: .github/egress-firewall.yaml).
runs-on: ubuntu-24.04-firewall
timeout-minutes: 10
permissions:
contents: read
@@ -33,5 +35,9 @@ jobs:
anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
# --permission-mode auto: a tool call that needs permission and is outside the allowed-tools list in
# .claude/commands/label-issue.md runs only if Claude Code's safety review passes it. Tools in
# --disallowedTools never run. --model is set because Claude Code's default model changes between releases.
claude_args: '--model claude-opus-5 --permission-mode auto --disallowedTools "WebFetch,WebSearch,Write,Edit,MultiEdit,NotebookEdit"'
allowed_non_write_users: "*" # Required for issue triage workflow, if users without repo write access create issues
github_token: ${{ secrets.GITHUB_TOKEN }}
+9 -4
View File
@@ -17,11 +17,16 @@ permissions:
contents: read
id-token: write
# Pin the model so these tests don't depend on the CLI's default model,
# which can change with each Claude Code release.
env:
ANTHROPIC_MODEL: claude-opus-5
jobs:
test-inline-prompt:
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-firewall
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -33,7 +38,7 @@ jobs:
anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
claude_args: '--allowedTools "LS,Read"'
claude_args: '--allowedTools "LS,Read" --permission-mode auto'
- name: Verify inline prompt output
run: |
@@ -74,7 +79,7 @@ jobs:
test-prompt-file:
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-firewall
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -94,7 +99,7 @@ jobs:
anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
claude_args: '--allowedTools "LS,Read"'
claude_args: '--allowedTools "LS,Read" --permission-mode auto'
- name: Verify prompt file output
run: |
@@ -12,11 +12,16 @@ permissions:
contents: read
id-token: write
# Pin the model so these tests don't depend on the CLI's default model,
# which can change with each Claude Code release.
env:
ANTHROPIC_MODEL: claude-opus-5
jobs:
test-custom-executables:
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-firewall
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -61,7 +66,7 @@ jobs:
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
path_to_claude_code_executable: /home/runner/.local/bin/claude
path_to_bun_executable: /home/runner/.bun/bin/bun
claude_args: '--allowedTools "LS,Read"'
claude_args: '--allowedTools "LS,Read" --permission-mode auto'
- name: Verify custom executables worked
run: |
+9 -3
View File
@@ -12,11 +12,16 @@ permissions:
contents: read
id-token: write
# Pin the model so these tests don't depend on the CLI's default model,
# which can change with each Claude Code release.
env:
ANTHROPIC_MODEL: claude-opus-5
jobs:
test-mcp-integration:
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-firewall
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -38,7 +43,7 @@ jobs:
anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
claude_args: --allowedTools mcp__test-server__test_tool
claude_args: --allowedTools mcp__test-server__test_tool --permission-mode auto
env:
# Change to test directory so it finds .mcp.json
CLAUDE_WORKING_DIR: ${{ github.workspace }}/base-action/test/mcp-test
@@ -98,7 +103,7 @@ jobs:
test-mcp-config-flag:
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-firewall
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -133,6 +138,7 @@ jobs:
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
claude_args: |
--permission-mode auto
--allowedTools mcp__test-server__test_tool
--mcp-config '{"mcpServers":{"test-server":{"type":"stdio","command":"bun","args":["simple-mcp-server.ts"],"env":{}}}}'
env:
+13 -4
View File
@@ -12,11 +12,16 @@ permissions:
contents: read
id-token: write
# Pin the model so these tests don't depend on the CLI's default model,
# which can change with each Claude Code release.
env:
ANTHROPIC_MODEL: claude-opus-5
jobs:
test-settings-inline-allow:
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-firewall
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -29,6 +34,7 @@ jobs:
anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
claude_args: "--permission-mode auto"
settings: |
{
"permissions": {
@@ -69,7 +75,7 @@ jobs:
test-settings-inline-deny:
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-firewall
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -82,6 +88,7 @@ jobs:
anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
claude_args: "--permission-mode auto"
settings: |
{
"permissions": {
@@ -105,7 +112,7 @@ jobs:
test-settings-file-allow:
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-firewall
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -128,6 +135,7 @@ jobs:
anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
claude_args: "--permission-mode auto"
settings: "test-settings.json"
- name: Verify echo worked
@@ -163,7 +171,7 @@ jobs:
test-settings-file-deny:
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-firewall
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -186,6 +194,7 @@ jobs:
anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
claude_args: "--permission-mode auto"
settings: "test-settings.json"
- name: Verify echo was denied
+15 -5
View File
@@ -12,12 +12,17 @@ permissions:
contents: read
id-token: write
# Pin the model so these tests don't depend on the CLI's default model,
# which can change with each Claude Code release.
env:
ANTHROPIC_MODEL: claude-opus-5
jobs:
test-basic-types:
name: Test Basic Type Conversions
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-firewall
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -38,6 +43,7 @@ jobs:
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
claude_args: |
--permission-mode auto
--allowedTools Bash
--json-schema '{"type":"object","properties":{"text_field":{"type":"string"},"number_field":{"type":"number"},"boolean_true":{"type":"boolean"},"boolean_false":{"type":"boolean"}},"required":["text_field","number_field","boolean_true","boolean_false"]}'
@@ -80,7 +86,7 @@ jobs:
name: Test Arrays and Objects
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-firewall
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -100,6 +106,7 @@ jobs:
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
claude_args: |
--permission-mode auto
--allowedTools Bash
--json-schema '{"type":"object","properties":{"items":{"type":"array","items":{"type":"string"}},"config":{"type":"object"},"empty_array":{"type":"array"}},"required":["items","config","empty_array"]}'
@@ -135,7 +142,7 @@ jobs:
name: Test Edge Cases
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-firewall
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -156,6 +163,7 @@ jobs:
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
claude_args: |
--permission-mode auto
--allowedTools Bash
--json-schema '{"type":"object","properties":{"zero":{"type":"number"},"empty_string":{"type":"string"},"negative":{"type":"number"},"decimal":{"type":"number"}},"required":["zero","empty_string","negative","decimal"]}'
@@ -198,7 +206,7 @@ jobs:
name: Test Output Name Sanitization
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-firewall
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -214,6 +222,7 @@ jobs:
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
claude_args: |
--permission-mode auto
--allowedTools Bash
--json-schema '{"type":"object","properties":{"test-result":{"type":"string"},"item_count":{"type":"number"}},"required":["test-result","item_count"]}'
@@ -242,7 +251,7 @@ jobs:
name: Test Execution File Format
# Skip on fork PRs since they can't mint the OIDC token used for Claude API auth
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-firewall
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -256,6 +265,7 @@ jobs:
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
claude_args: |
--permission-mode auto
--allowedTools Bash
--json-schema '{"type":"object","properties":{"done":{"type":"boolean"}},"required":["done"]}'
+23
View File
@@ -0,0 +1,23 @@
# Fails when a workflow job that calls Claude lacks its security settings.
# The rules are in CLAUDE.md, "Security hardening for GitHub Actions".
name: Security check for workflows that call Claude
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
workflow-hardening:
name: Check security settings
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check security settings of workflows that call Claude
run: python3 .github/scripts/check_workflow_hardening.py
+14
View File
@@ -42,3 +42,17 @@ Single entrypoint: `src/entrypoints/run.ts` orchestrates everything — prepare
- `moduleResolution: "bundler"` — imports don't need `.js` extensions.
- GitHub API calls should use retry logic (`src/utils/retry.ts`).
- MCP servers are auto-installed at runtime to `~/.claude/mcp/github-{type}-server/`.
## Security hardening for GitHub Actions
Workflow jobs in this repository that call Claude run with three protections. Keep them when you add or edit a workflow.
1. **Egress-firewall runner.** The job has `runs-on: ubuntu-24.04-firewall`, a GitHub-hosted runner that filters the job's outbound network traffic. Do not move a job that calls Claude to another runner.
2. **Network allow list.** `.github/egress-firewall.yaml` lists the hosts those jobs may reach, besides any that GitHub's firewall allows by default. Keep `mode: enforce`, which is what makes the firewall block the rest. Follow that file's header when you add a host.
3. **Auto permission mode.** Every step that runs the Claude Code action (`uses: anthropics/claude-code-action`, or this repository's own `./` and `./base-action`) passes `--permission-mode auto` in `claude_args`. A tool call that needs permission and that the allowed tools do not cover then runs only if Claude Code's safety review passes it. Allow only the tools the job needs, and keep any `--disallowedTools` list a step has. Use `claude-opus-4-6` or a newer model: on an older one Claude Code falls back to its default permission mode.
`claude.yml` answers `@claude` mentions. The Claude Code action sets `--permission-mode acceptEdits` for those, and the `--permission-mode auto` in the workflow's `claude_args`, which comes after it, replaces it.
`.github/workflows/workflow-hardening.yml` fails when a job that runs the Claude Code action or mentions `ANTHROPIC_FEDERATION_RULE_ID` breaks protection 1 or 3, or when the allow list is missing, empty, not `mode: enforce`, or names a host with `*`. It cannot see a job that calls Claude another way, so check new workflows by hand too. If a job cannot meet protection 1 or 3, add it with the reason to the matching exemption table in `.github/scripts/check_workflow_hardening.py`. A job in `EXEMPT_FROM_AUTO_MODE` must set no permission mode at all. Do not skip or weaken the check.
Keep each workflow's `permissions:` block minimal, and never print tokens or environment variables in workflow logs.
+1 -1
View File
@@ -194,7 +194,7 @@ runs:
if: inputs.path_to_bun_executable == ''
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # https://github.com/oven-sh/setup-bun/releases/tag/v2.2.0
with:
bun-version: 1.3.14
bun-version: 1.4.4
token: ${{ inputs.github_token || github.token }}
# Disable setup-bun's cache. The upstream save step uses a deterministic
# key (Bun version) and isn't ref-aware: on every second-and-subsequent
+2 -2
View File
@@ -120,7 +120,7 @@ runs:
if: inputs.path_to_bun_executable == ''
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # https://github.com/oven-sh/setup-bun/releases/tag/v2.2.0
with:
bun-version: 1.3.14
bun-version: 1.4.4
# Disable setup-bun's cache. See action.yml for details and issue #1252.
no-cache: true
@@ -147,7 +147,7 @@ runs:
PATH_TO_CLAUDE_CODE_EXECUTABLE: ${{ inputs.path_to_claude_code_executable }}
run: |
if [ -z "$PATH_TO_CLAUDE_CODE_EXECUTABLE" ]; then
CLAUDE_CODE_VERSION="2.1.241"
CLAUDE_CODE_VERSION="2.1.311"
echo "Installing Claude Code v${CLAUDE_CODE_VERSION}..."
for attempt in 1 2 3; do
echo "Installation attempt $attempt..."
+17 -19
View File
@@ -6,11 +6,11 @@
"name": "@anthropic-ai/claude-code-base-action",
"dependencies": {
"@actions/core": "^1.10.1",
"@anthropic-ai/claude-agent-sdk": "^0.3.241",
"@anthropic-ai/claude-agent-sdk": "^0.3.311",
"shell-quote": "^1.8.4",
},
"devDependencies": {
"@types/bun": "^1.2.12",
"@types/bun": "^1.4.3",
"@types/node": "^20.0.0",
"@types/shell-quote": "^1.7.5",
"prettier": "3.5.3",
@@ -27,23 +27,23 @@
"@actions/io": ["@actions/[email protected]", "", {}, "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q=="],
"@anthropic-ai/claude-agent-sdk": ["@anthropic-ai/[email protected].243", "", { "optionalDependencies": { "@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.243", "@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.243", "@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.243", "@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.243", "@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.243", "@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.243", "@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.243", "@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.243" }, "peerDependencies": { "@anthropic-ai/sdk": ">=0.93.0", "@modelcontextprotocol/sdk": "^1.29.0", "zod": "^4.0.0" } }, "sha512-J+C5q1O7mIvVAIinsKM0gPefHuCQ3LEz1CMY8PsuJbYQflYGA+S/LfMlobwi3wd21I4W/xfgiWUM1+cf9hwdAA=="],
"@anthropic-ai/claude-agent-sdk": ["@anthropic-ai/[email protected].311", "", { "optionalDependencies": { "@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.311", "@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.311", "@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.311", "@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.311", "@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.311", "@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.311", "@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.311", "@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.311" }, "peerDependencies": { "@anthropic-ai/sdk": ">=0.93.0", "@modelcontextprotocol/sdk": "^1.29.0", "zod": "^4.0.0" } }, "sha512-8aKYcHGB3LsYP79e2EHNdwbpIvRJkMLd19qSx4u9+J9yDDAK7w9uy1GyvFUz8xa1A+xIEtTW1k/r419uE/Kbsw=="],
"@anthropic-ai/claude-agent-sdk-darwin-arm64": ["@anthropic-ai/[email protected].243", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Cx+Rb+pN0OYmzh9btHQjdNofpGBvDPlf0L9fX7f9vgeXg2CZRTKEsgNJjKvXaBmdCLTppVz5+1Qw9uUpZGQXRQ=="],
"@anthropic-ai/claude-agent-sdk-darwin-arm64": ["@anthropic-ai/[email protected].311", "", { "os": "darwin", "cpu": "arm64" }, "sha512-pzlXQGLh3pH/oIAliApR79OIkTFTAGpWJpf1HLt5MocWPBxox/aoHVWOKHqbnYnmGrr54LwdG+E4V1boaQzyvA=="],
"@anthropic-ai/claude-agent-sdk-darwin-x64": ["@anthropic-ai/[email protected].243", "", { "os": "darwin", "cpu": "x64" }, "sha512-D0weMVD3xTOzWBbA+7yYPJDm1D9TmP7hTbqZMe33eTbl0rmKvvjftzRBGIGTiRo0d6nDgCAyx/tt8G0TOkSzMA=="],
"@anthropic-ai/claude-agent-sdk-darwin-x64": ["@anthropic-ai/[email protected].311", "", { "os": "darwin", "cpu": "x64" }, "sha512-xVoQD+ZwScwbPitYBmedm1/j3dUIyyLFB1zgk3q99YQXac6r6wAKR4HP+QTrrEwsQa0slePbE/Ljj/5u2z14nw=="],
"@anthropic-ai/claude-agent-sdk-linux-arm64": ["@anthropic-ai/[email protected].243", "", { "os": "linux", "cpu": "arm64" }, "sha512-cXIikR6wGv3PtCGAZbGP/9L4QVJryjspPmCX+c4KbrNrWRDTkJwBLA19jkKrh0hia7JCi3KlrjmgDxO0VLh38w=="],
"@anthropic-ai/claude-agent-sdk-linux-arm64": ["@anthropic-ai/[email protected].311", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-iCic3eanG/Cb6MZan0uiGzBExwVu3ZDABih5uR0iBQ/bVF0yXiG79EwwJC7DPzgu2RQghtECR+q6wx/+Z2YUHg=="],
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": ["@anthropic-ai/[email protected].243", "", { "os": "linux", "cpu": "arm64" }, "sha512-rRycylcOcuQq0tx4RgElHNt00TbSlRShw28I6flEikBDfmcyycIn8NsQFDgDNkBcu9Ih6sp+cdwpq/6vspCnJw=="],
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": ["@anthropic-ai/[email protected].311", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-sXUjbaZCguGRUmTC5nJWbj7pmvT+RiUXxiGx7/o4Lj+V3BqL2YdQh33blYWFw+9HlVC2+sKSMWfEsVh0GHcA6A=="],
"@anthropic-ai/claude-agent-sdk-linux-x64": ["@anthropic-ai/[email protected].243", "", { "os": "linux", "cpu": "x64" }, "sha512-+nepHfQV5XEsv+TickUTPdIV617YAmg5/XYppc25CQ22jBYuk+rnMfMTOV+PdqLs7Ej62PjJityWGSbwezVvLw=="],
"@anthropic-ai/claude-agent-sdk-linux-x64": ["@anthropic-ai/[email protected].311", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-yq7zMyESMnznCLTre5NRmyfedDp24I2c94DdCq9TCMRUQEhhW1Zb2UC9QAQP28ZzncP2dSs70EM8Nvp2+VBSqg=="],
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": ["@anthropic-ai/[email protected].243", "", { "os": "linux", "cpu": "x64" }, "sha512-+sIfj2NFfHjnnrYGL/H/GwIZQNBTeiMm19RGZNtjdg0CPfsPgi+RiNcO53a2wfGpy0KXoMPDP5j3CTBuWAgMEg=="],
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": ["@anthropic-ai/[email protected].311", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-BFSmzqnnVnNirnfy8EJ5f/S3G0JHjN+V0bBVJGDy3Mn1ptfV4/832Wh9hIkwYGVii+jA5aoanSVG3b9tK/I8ZA=="],
"@anthropic-ai/claude-agent-sdk-win32-arm64": ["@anthropic-ai/[email protected].243", "", { "os": "win32", "cpu": "arm64" }, "sha512-Ocggl6UfvD41FF6oTtCGPXGMmegmSd0eCE851QiMVgnqwYxGUaiYTxOQxAxOWtPfKiXeVMHMkWEAaJYHLS5l+w=="],
"@anthropic-ai/claude-agent-sdk-win32-arm64": ["@anthropic-ai/[email protected].311", "", { "os": "win32", "cpu": "arm64" }, "sha512-DEWpHyDg86ffG3I0hHxLTfrOshzGBea4mrhNxj43jpbyO1vl9de8KYlnazhruNPi6u6mxL5ly5ihhxeWuutE1A=="],
"@anthropic-ai/claude-agent-sdk-win32-x64": ["@anthropic-ai/[email protected].243", "", { "os": "win32", "cpu": "x64" }, "sha512-7cOK56jiA3GTmaf+4b1I/me6xy0TGPFzQBwOhnErmPfja3jM2dtMU4PrrbJ8q5Qm8tZXW9IkbFD/LioyLV14Ig=="],
"@anthropic-ai/claude-agent-sdk-win32-x64": ["@anthropic-ai/[email protected].311", "", { "os": "win32", "cpu": "x64" }, "sha512-I92TwBhMkpc9pLwu1SwLiz6wqXkcmMPAdz4LgpwKAeyB5rum2GyZgYPIDTRYEpo3cX0nEP2qmyxtKEO/tLFfoA=="],
"@anthropic-ai/sdk": ["@anthropic-ai/[email protected]", "", { "dependencies": { "json-schema-to-ts": "^3.1.1" }, "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" }, "optionalPeers": ["zod"], "bin": { "anthropic-ai-sdk": "bin/cli" } }, "sha512-q9vaSZQVFx6B/gPxetGYfLXSJD5v0sOmh0OpZDq7yCrTSA+Rscvrtyol7JJTW40wEpQB4U1B4JXzxQitbQ3CAA=="],
@@ -55,12 +55,10 @@
"@modelcontextprotocol/sdk": ["@modelcontextprotocol/[email protected]", "", { "dependencies": { "@hono/node-server": "^1.19.9", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.2.1", "express-rate-limit": "^8.2.1", "hono": "^4.11.4", "jose": "^6.1.3", "json-schema-typed": "^8.0.2", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.25 || ^4.0", "zod-to-json-schema": "^3.25.1" }, "peerDependencies": { "@cfworker/json-schema": "^4.1.1" }, "optionalPeers": ["@cfworker/json-schema"] }, "sha512-zo37mZA9hJWpULgkRpowewez1y6ML5GsXJPY8FI0tBBCd77HEvza4jDqRKOXgHNn867PVGCyTdzqpz0izu5ZjQ=="],
"@types/bun": ["@types/bun@1.2.19", "", { "dependencies": { "bun-types": "1.2.19" } }, "sha512-d9ZCmrH3CJ2uYKXQIUuZ/pUnTqIvLDS0SK7pFmbx8ma+ziH/FRMoAq5bYpRG7y+w1gl+HgyNZbtqgMq4W4e2Lg=="],
"@types/bun": ["@types/bun@1.4.3", "", { "dependencies": { "bun-types": "1.4.3" } }, "sha512-N67Pqy8JXbAY/j0tNraS3V5mubGvc6rrrNDmDCtZLlFzccbUJPDb0tvgUBC5q4m8ybkP93Jcn1QB+RYQ6PvBhw=="],
"@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-cuVNgarYWZqxRJDQHEB58GEONhOK79QVR/qYx4S7kcUObQvUwvFnYxJuuHUKm2aieN9X3yZB4LZsuYNU1Qphsw=="],
"@types/react": ["@types/[email protected]", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g=="],
"@types/shell-quote": ["@types/[email protected]", "", {}, "sha512-+UE8GAGRPbJVQDdxi16dgadcBfQ+KG2vgZhV1+3A1XmHbmwcdwhCUwIdy+d3pAGrbvgRoVSjeI9vOWyq376Yzw=="],
"accepts": ["[email protected]", "", { "dependencies": { "mime-types": "^3.0.0", "negotiator": "^1.0.0" } }, "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng=="],
@@ -71,7 +69,7 @@
"body-parser": ["[email protected]", "", { "dependencies": { "bytes": "^3.1.2", "content-type": "^1.0.5", "debug": "^4.4.3", "http-errors": "^2.0.0", "iconv-lite": "^0.7.0", "on-finished": "^2.4.1", "qs": "^6.14.1", "raw-body": "^3.0.1", "type-is": "^2.0.1" } }, "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA=="],
"bun-types": ["bun-types@1.2.19", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-uAOTaZSPuYsWIXRpj7o56Let0g/wjihKCkeRqUBhlLVM/Bt+Fj9xTo+LhC1OV1XDaGkz4hNC80et5xgy+9KTHQ=="],
"bun-types": ["bun-types@1.4.3", "", { "dependencies": { "@types/node": "*", "undici-types": "*" } }, "sha512-tinRJNGOmUN+tEAsn2y2e942n9JHRHR42iUYzDH75NmhJqVBokGSQkkfSFdNWwsANIdrK6ACH9t01M452YyTwg=="],
"bytes": ["[email protected]", "", {}, "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="],
@@ -91,8 +89,6 @@
"cross-spawn": ["[email protected]", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
"csstype": ["[email protected]", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
"debug": ["[email protected]", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
"depd": ["[email protected]", "", {}, "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="],
@@ -257,8 +253,10 @@
"wrappy": ["[email protected]", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
"zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="],
"zod": ["zod@4.6.7", "", {}, "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg=="],
"zod-to-json-schema": ["zod-to-json-schema@3.25.2", "", { "peerDependencies": { "zod": "^3.25.28 || ^4" } }, "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA=="],
"@modelcontextprotocol/sdk/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="],
"@modelcontextprotocol/sdk/zod-to-json-schema": ["[email protected]", "", { "peerDependencies": { "zod": "^3.25.28 || ^4" } }, "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA=="],
}
}
+2 -2
View File
@@ -11,11 +11,11 @@
},
"dependencies": {
"@actions/core": "^1.10.1",
"@anthropic-ai/claude-agent-sdk": "^0.3.241",
"@anthropic-ai/claude-agent-sdk": "^0.3.311",
"shell-quote": "^1.8.4"
},
"devDependencies": {
"@types/bun": "^1.2.12",
"@types/bun": "^1.4.3",
"@types/node": "^20.0.0",
"@types/shell-quote": "^1.7.5",
"prettier": "3.5.3",
+15 -27
View File
@@ -7,7 +7,7 @@
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.1",
"@anthropic-ai/claude-agent-sdk": "^0.3.241",
"@anthropic-ai/claude-agent-sdk": "^0.3.311",
"@modelcontextprotocol/sdk": "^1.11.0",
"@octokit/graphql": "^8.2.2",
"@octokit/rest": "^21.1.1",
@@ -17,7 +17,7 @@
"zod": "^3.24.4",
},
"devDependencies": {
"@types/bun": "1.2.11",
"@types/bun": "1.4.3",
"@types/node": "^20.0.0",
"@types/node-fetch": "^2.6.12",
"@types/shell-quote": "^1.7.5",
@@ -37,23 +37,23 @@
"@actions/io": ["@actions/[email protected]", "", {}, "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q=="],
"@anthropic-ai/claude-agent-sdk": ["@anthropic-ai/[email protected].243", "", { "optionalDependencies": { "@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.243", "@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.243", "@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.243", "@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.243", "@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.243", "@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.243", "@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.243", "@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.243" }, "peerDependencies": { "@anthropic-ai/sdk": ">=0.93.0", "@modelcontextprotocol/sdk": "^1.29.0", "zod": "^4.0.0" } }, "sha512-J+C5q1O7mIvVAIinsKM0gPefHuCQ3LEz1CMY8PsuJbYQflYGA+S/LfMlobwi3wd21I4W/xfgiWUM1+cf9hwdAA=="],
"@anthropic-ai/claude-agent-sdk": ["@anthropic-ai/[email protected].311", "", { "optionalDependencies": { "@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.311", "@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.311", "@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.311", "@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.311", "@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.311", "@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.311", "@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.311", "@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.311" }, "peerDependencies": { "@anthropic-ai/sdk": ">=0.93.0", "@modelcontextprotocol/sdk": "^1.29.0", "zod": "^4.0.0" } }, "sha512-8aKYcHGB3LsYP79e2EHNdwbpIvRJkMLd19qSx4u9+J9yDDAK7w9uy1GyvFUz8xa1A+xIEtTW1k/r419uE/Kbsw=="],
"@anthropic-ai/claude-agent-sdk-darwin-arm64": ["@anthropic-ai/[email protected].243", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Cx+Rb+pN0OYmzh9btHQjdNofpGBvDPlf0L9fX7f9vgeXg2CZRTKEsgNJjKvXaBmdCLTppVz5+1Qw9uUpZGQXRQ=="],
"@anthropic-ai/claude-agent-sdk-darwin-arm64": ["@anthropic-ai/[email protected].311", "", { "os": "darwin", "cpu": "arm64" }, "sha512-pzlXQGLh3pH/oIAliApR79OIkTFTAGpWJpf1HLt5MocWPBxox/aoHVWOKHqbnYnmGrr54LwdG+E4V1boaQzyvA=="],
"@anthropic-ai/claude-agent-sdk-darwin-x64": ["@anthropic-ai/[email protected].243", "", { "os": "darwin", "cpu": "x64" }, "sha512-D0weMVD3xTOzWBbA+7yYPJDm1D9TmP7hTbqZMe33eTbl0rmKvvjftzRBGIGTiRo0d6nDgCAyx/tt8G0TOkSzMA=="],
"@anthropic-ai/claude-agent-sdk-darwin-x64": ["@anthropic-ai/[email protected].311", "", { "os": "darwin", "cpu": "x64" }, "sha512-xVoQD+ZwScwbPitYBmedm1/j3dUIyyLFB1zgk3q99YQXac6r6wAKR4HP+QTrrEwsQa0slePbE/Ljj/5u2z14nw=="],
"@anthropic-ai/claude-agent-sdk-linux-arm64": ["@anthropic-ai/[email protected].243", "", { "os": "linux", "cpu": "arm64" }, "sha512-cXIikR6wGv3PtCGAZbGP/9L4QVJryjspPmCX+c4KbrNrWRDTkJwBLA19jkKrh0hia7JCi3KlrjmgDxO0VLh38w=="],
"@anthropic-ai/claude-agent-sdk-linux-arm64": ["@anthropic-ai/[email protected].311", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-iCic3eanG/Cb6MZan0uiGzBExwVu3ZDABih5uR0iBQ/bVF0yXiG79EwwJC7DPzgu2RQghtECR+q6wx/+Z2YUHg=="],
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": ["@anthropic-ai/[email protected].243", "", { "os": "linux", "cpu": "arm64" }, "sha512-rRycylcOcuQq0tx4RgElHNt00TbSlRShw28I6flEikBDfmcyycIn8NsQFDgDNkBcu9Ih6sp+cdwpq/6vspCnJw=="],
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": ["@anthropic-ai/[email protected].311", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-sXUjbaZCguGRUmTC5nJWbj7pmvT+RiUXxiGx7/o4Lj+V3BqL2YdQh33blYWFw+9HlVC2+sKSMWfEsVh0GHcA6A=="],
"@anthropic-ai/claude-agent-sdk-linux-x64": ["@anthropic-ai/[email protected].243", "", { "os": "linux", "cpu": "x64" }, "sha512-+nepHfQV5XEsv+TickUTPdIV617YAmg5/XYppc25CQ22jBYuk+rnMfMTOV+PdqLs7Ej62PjJityWGSbwezVvLw=="],
"@anthropic-ai/claude-agent-sdk-linux-x64": ["@anthropic-ai/[email protected].311", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-yq7zMyESMnznCLTre5NRmyfedDp24I2c94DdCq9TCMRUQEhhW1Zb2UC9QAQP28ZzncP2dSs70EM8Nvp2+VBSqg=="],
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": ["@anthropic-ai/[email protected].243", "", { "os": "linux", "cpu": "x64" }, "sha512-+sIfj2NFfHjnnrYGL/H/GwIZQNBTeiMm19RGZNtjdg0CPfsPgi+RiNcO53a2wfGpy0KXoMPDP5j3CTBuWAgMEg=="],
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": ["@anthropic-ai/[email protected].311", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-BFSmzqnnVnNirnfy8EJ5f/S3G0JHjN+V0bBVJGDy3Mn1ptfV4/832Wh9hIkwYGVii+jA5aoanSVG3b9tK/I8ZA=="],
"@anthropic-ai/claude-agent-sdk-win32-arm64": ["@anthropic-ai/[email protected].243", "", { "os": "win32", "cpu": "arm64" }, "sha512-Ocggl6UfvD41FF6oTtCGPXGMmegmSd0eCE851QiMVgnqwYxGUaiYTxOQxAxOWtPfKiXeVMHMkWEAaJYHLS5l+w=="],
"@anthropic-ai/claude-agent-sdk-win32-arm64": ["@anthropic-ai/[email protected].311", "", { "os": "win32", "cpu": "arm64" }, "sha512-DEWpHyDg86ffG3I0hHxLTfrOshzGBea4mrhNxj43jpbyO1vl9de8KYlnazhruNPi6u6mxL5ly5ihhxeWuutE1A=="],
"@anthropic-ai/claude-agent-sdk-win32-x64": ["@anthropic-ai/[email protected].243", "", { "os": "win32", "cpu": "x64" }, "sha512-7cOK56jiA3GTmaf+4b1I/me6xy0TGPFzQBwOhnErmPfja3jM2dtMU4PrrbJ8q5Qm8tZXW9IkbFD/LioyLV14Ig=="],
"@anthropic-ai/claude-agent-sdk-win32-x64": ["@anthropic-ai/[email protected].311", "", { "os": "win32", "cpu": "x64" }, "sha512-I92TwBhMkpc9pLwu1SwLiz6wqXkcmMPAdz4LgpwKAeyB5rum2GyZgYPIDTRYEpo3cX0nEP2qmyxtKEO/tLFfoA=="],
"@anthropic-ai/sdk": ["@anthropic-ai/[email protected]", "", { "dependencies": { "json-schema-to-ts": "^3.1.1" }, "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" }, "optionalPeers": ["zod"], "bin": { "anthropic-ai-sdk": "bin/cli" } }, "sha512-q9vaSZQVFx6B/gPxetGYfLXSJD5v0sOmh0OpZDq7yCrTSA+Rscvrtyol7JJTW40wEpQB4U1B4JXzxQitbQ3CAA=="],
@@ -75,8 +75,6 @@
"@octokit/plugin-paginate-rest": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/types": "^12.6.0" }, "peerDependencies": { "@octokit/core": "5" } }, "sha512-u3KYkGF7GcZnSD/3UP0S7K5XUFT2FkOQdcfXZGZQPGv3lm4F2Xbf71lvjldr8c1H3nNbF+33cLEkWYbokGWqiQ=="],
"@octokit/plugin-request-log": ["@octokit/[email protected]", "", { "peerDependencies": { "@octokit/core": ">=6" } }, "sha512-n/lNeCtq+9ofhC15xzmJCNKP2BWTv8Ih2TTy+jatNCCq/gQP/V7rK3fjIfuz0pDWDALO/o/4QY4hyOF6TQQFUw=="],
"@octokit/plugin-rest-endpoint-methods": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/types": "^12.6.0" }, "peerDependencies": { "@octokit/core": "5" } }, "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg=="],
"@octokit/request": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/endpoint": "^9.0.6", "@octokit/request-error": "^5.1.1", "@octokit/types": "^13.1.0", "universal-user-agent": "^6.0.0" } }, "sha512-qnB2+SY3hkCmBxZsR/MPCybNmbJe4KAlfWErXq+rBKkQJlbjdJeS85VI9r8UqeLYLvnAenU8Q1okM/0MBsAGXw=="],
@@ -89,7 +87,7 @@
"@octokit/webhooks-types": ["@octokit/[email protected]", "", {}, "sha512-S8u2cJzklBC0FgTwWVLaM8tMrDuDMVE4xiTK4EYXM9GntyvrdbSoxqDQa+Fh57CCNApyIpyeqPhhFEmHPfrXgw=="],
"@types/bun": ["@types/bun@1.2.11", "", { "dependencies": { "bun-types": "1.2.11" } }, "sha512-ZLbbI91EmmGwlWTRWuV6J19IUiUC5YQ3TCEuSHI3usIP75kuoA8/0PVF+LTrbEnVc8JIhpElWOxv1ocI1fJBbw=="],
"@types/bun": ["@types/bun@1.4.3", "", { "dependencies": { "bun-types": "1.4.3" } }, "sha512-N67Pqy8JXbAY/j0tNraS3V5mubGvc6rrrNDmDCtZLlFzccbUJPDb0tvgUBC5q4m8ybkP93Jcn1QB+RYQ6PvBhw=="],
"@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-cuVNgarYWZqxRJDQHEB58GEONhOK79QVR/qYx4S7kcUObQvUwvFnYxJuuHUKm2aieN9X3yZB4LZsuYNU1Qphsw=="],
@@ -107,7 +105,7 @@
"body-parser": ["[email protected]", "", { "dependencies": { "bytes": "^3.1.2", "content-type": "^1.0.5", "debug": "^4.4.0", "http-errors": "^2.0.0", "iconv-lite": "^0.6.3", "on-finished": "^2.4.1", "qs": "^6.14.0", "raw-body": "^3.0.0", "type-is": "^2.0.0" } }, "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg=="],
"bun-types": ["bun-types@1.2.11", "", { "dependencies": { "@types/node": "*" } }, "sha512-dbkp5Lo8HDrXkLrONm6bk+yiiYQSntvFUzQp0v3pzTAsXk6FtgVMjdQ+lzFNVAmQFUkPQZ3WMZqH5tTo+Dp/IA=="],
"bun-types": ["bun-types@1.4.3", "", { "dependencies": { "@types/node": "*", "undici-types": "*" } }, "sha512-tinRJNGOmUN+tEAsn2y2e942n9JHRHR42iUYzDH75NmhJqVBokGSQkkfSFdNWwsANIdrK6ACH9t01M452YyTwg=="],
"bytes": ["[email protected]", "", {}, "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="],
@@ -333,8 +331,6 @@
"@octokit/plugin-paginate-rest/@octokit/types": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/openapi-types": "^20.0.0" } }, "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw=="],
"@octokit/plugin-request-log/@octokit/core": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/auth-token": "^5.0.0", "@octokit/graphql": "^8.2.2", "@octokit/request": "^9.2.3", "@octokit/request-error": "^6.1.8", "@octokit/types": "^14.0.0", "before-after-hook": "^3.0.2", "universal-user-agent": "^7.0.0" } }, "sha512-kIU8SLQkYWGp3pVKiYzA5OSaNF5EE03P/R8zEmmrG6XwOg5oBjXyQVVIauQ0dgau4zYhpZEhJrvIYt6oM+zZZA=="],
"@octokit/plugin-rest-endpoint-methods/@octokit/types": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/openapi-types": "^20.0.0" } }, "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw=="],
"@octokit/request/@octokit/types": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/openapi-types": "^24.2.0" } }, "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA=="],
@@ -347,6 +343,8 @@
"@octokit/rest/@octokit/plugin-paginate-rest": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/types": "^13.10.0" }, "peerDependencies": { "@octokit/core": ">=6" } }, "sha512-n5KPteiF7pWKgBIBJSk8qzoZWcUkza2O6A0za97pMGVrGfPdltxrfmfF5GucHYvHGZD8BdaZmmHGz5cX/3gdpw=="],
"@octokit/rest/@octokit/plugin-request-log": ["@octokit/[email protected]", "", { "peerDependencies": { "@octokit/core": ">=6" } }, "sha512-n/lNeCtq+9ofhC15xzmJCNKP2BWTv8Ih2TTy+jatNCCq/gQP/V7rK3fjIfuz0pDWDALO/o/4QY4hyOF6TQQFUw=="],
"@octokit/rest/@octokit/plugin-rest-endpoint-methods": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/types": "^13.10.0" }, "peerDependencies": { "@octokit/core": ">=6" } }, "sha512-9Pas60Iv9ejO3WlAX3maE1+38c5nqbJXV5GrncEfkndIpZrJ/WPMRd2xYDcPPEt5yzpxcjw9fWNoPhsSGzqKqw=="],
"accepts/mime-types": ["[email protected]", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA=="],
@@ -367,14 +365,6 @@
"@octokit/plugin-paginate-rest/@octokit/types/@octokit/openapi-types": ["@octokit/[email protected]", "", {}, "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA=="],
"@octokit/plugin-request-log/@octokit/core/@octokit/auth-token": ["@octokit/[email protected]", "", {}, "sha512-JcQDsBdg49Yky2w2ld20IHAlwr8d/d8N6NiOXbtuoPCqzbsiJgF633mVUw3x4mo0H5ypataQIX7SFu3yy44Mpw=="],
"@octokit/plugin-request-log/@octokit/core/@octokit/request": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/endpoint": "^10.1.4", "@octokit/request-error": "^6.1.8", "@octokit/types": "^14.0.0", "fast-content-type-parse": "^2.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-q8ybdytBmxa6KogWlNa818r0k1wlqzNC+yNkcQDECHvQo8Vmstrg18JwqJHdJdUiHD2sjlwBgSm9kHkOKe2iyA=="],
"@octokit/plugin-request-log/@octokit/core/@octokit/request-error": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/types": "^14.0.0" } }, "sha512-WEi/R0Jmq+IJKydWlKDmryPcmdYSVjL3ekaiEL1L9eo1sUnqMJ+grqmC9cjk7CA7+b2/T397tO5d8YLOH3qYpQ=="],
"@octokit/plugin-request-log/@octokit/core/before-after-hook": ["[email protected]", "", {}, "sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A=="],
"@octokit/plugin-rest-endpoint-methods/@octokit/types/@octokit/openapi-types": ["@octokit/[email protected]", "", {}, "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA=="],
"@octokit/request-error/@octokit/types/@octokit/openapi-types": ["@octokit/[email protected]", "", {}, "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg=="],
@@ -401,8 +391,6 @@
"type-is/mime-types/mime-db": ["[email protected]", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="],
"@octokit/plugin-request-log/@octokit/core/@octokit/request/@octokit/endpoint": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/types": "^14.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-OlYOlZIsfEVZm5HCSR8aSg02T2lbUWOsCQoPKfTXJwDzcHQBrVBGdGXb89dv2Kw2ToZaRtudp8O3ZIYoaOjKlA=="],
"@octokit/rest/@octokit/core/@octokit/request/@octokit/endpoint": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/types": "^14.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-OlYOlZIsfEVZm5HCSR8aSg02T2lbUWOsCQoPKfTXJwDzcHQBrVBGdGXb89dv2Kw2ToZaRtudp8O3ZIYoaOjKlA=="],
"@octokit/rest/@octokit/plugin-paginate-rest/@octokit/types/@octokit/openapi-types": ["@octokit/[email protected]", "", {}, "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg=="],
+2 -2
View File
@@ -12,7 +12,7 @@
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.1",
"@anthropic-ai/claude-agent-sdk": "^0.3.241",
"@anthropic-ai/claude-agent-sdk": "^0.3.311",
"@modelcontextprotocol/sdk": "^1.11.0",
"@octokit/graphql": "^8.2.2",
"@octokit/rest": "^21.1.1",
@@ -22,7 +22,7 @@
"zod": "^3.24.4"
},
"devDependencies": {
"@types/bun": "1.2.11",
"@types/bun": "1.4.3",
"@types/node": "^20.0.0",
"@types/node-fetch": "^2.6.12",
"@types/shell-quote": "^1.7.5",
+1 -1
View File
@@ -824,7 +824,7 @@ ${
? `- Use mcp__github_file_ops__commit_files for making commits (works for both new and existing files, single or multiple). Use mcp__github_file_ops__delete_files for deleting files (supports deleting single or multiple files atomically), or mcp__github__delete_file for deleting a single file. Edit files locally, and the tool will read the content from the same path on disk.
Tool usage examples:
- mcp__github_file_ops__commit_files: {"files": ["path/to/file1.js", "path/to/file2.py"], "message": "feat: add new feature"}
- mcp__github_file_ops__delete_files: {"files": ["path/to/old.js"], "message": "chore: remove deprecated file"}`
- mcp__github_file_ops__delete_files: {"paths": ["path/to/old.js"], "message": "chore: remove deprecated file"}`
: `- Use git commands via the Bash tool for version control (remember that you have access to these git commands):
- Stage files: Bash(git add <files>)
- Commit changes: Bash(git commit -m "<message>")
+1 -1
View File
@@ -77,7 +77,7 @@ async function installClaudeCode(): Promise<string> {
return customExecutable;
}
const claudeCodeVersion = "2.1.241";
const claudeCodeVersion = "2.1.311";
console.log(`Installing Claude Code v${claudeCodeVersion}...`);
for (let attempt = 1; attempt <= 3; attempt++) {
+2 -1
View File
@@ -16,6 +16,7 @@ import type { ParsedGitHubContext } from "../github/context";
import { GITHUB_SERVER_URL } from "../github/api/config";
import { checkAndCommitOrDeleteBranch } from "../github/operations/branch-cleanup";
import { updateClaudeComment } from "../github/operations/comments/update-claude-comment";
import { encodeBranchNameForUrl } from "../github/operations/comments/common";
export type UpdateCommentLinkParams = {
commentId: number;
@@ -159,7 +160,7 @@ export async function updateCommentLink(
const prBody = encodeURIComponent(
`This PR addresses ${entityType.toLowerCase()} #${context.entityNumber}\n\nGenerated with [Claude Code](https://claude.ai/code)`,
);
const prUrl = `${serverUrl}/${owner}/${repo}/compare/${baseBranch}...${claudeBranch}?quick_pull=1&title=${prTitle}&body=${prBody}`;
const prUrl = `${serverUrl}/${owner}/${repo}/compare/${encodeBranchNameForUrl(baseBranch)}...${encodeBranchNameForUrl(claudeBranch)}?quick_pull=1&title=${prTitle}&body=${prBody}`;
prLink = `\n[Create a PR](${prUrl})`;
}
} catch (error) {
+5 -4
View File
@@ -1,5 +1,6 @@
import type { Octokits } from "../api/client";
import { GITHUB_SERVER_URL } from "../api/config";
import { encodeBranchNameForUrl } from "./comments/common";
import { $ } from "bun";
export async function checkAndCommitOrDeleteBranch(
@@ -106,7 +107,7 @@ export async function checkAndCommitOrDeleteBranch(
);
// Set branch link since we now have commits
const branchUrl = `${GITHUB_SERVER_URL}/${owner}/${repo}/tree/${claudeBranch}`;
const branchUrl = `${GITHUB_SERVER_URL}/${owner}/${repo}/tree/${encodeBranchNameForUrl(claudeBranch)}`;
branchLink = `\n[View branch](${branchUrl})`;
} else {
console.log(
@@ -117,7 +118,7 @@ export async function checkAndCommitOrDeleteBranch(
} catch (gitError) {
console.error("Error checking/committing changes:", gitError);
// If we can't check git status, assume the branch might have changes
const branchUrl = `${GITHUB_SERVER_URL}/${owner}/${repo}/tree/${claudeBranch}`;
const branchUrl = `${GITHUB_SERVER_URL}/${owner}/${repo}/tree/${encodeBranchNameForUrl(claudeBranch)}`;
branchLink = `\n[View branch](${branchUrl})`;
}
} else {
@@ -128,13 +129,13 @@ export async function checkAndCommitOrDeleteBranch(
}
} else {
// Only add branch link if there are commits
const branchUrl = `${GITHUB_SERVER_URL}/${owner}/${repo}/tree/${claudeBranch}`;
const branchUrl = `${GITHUB_SERVER_URL}/${owner}/${repo}/tree/${encodeBranchNameForUrl(claudeBranch)}`;
branchLink = `\n[View branch](${branchUrl})`;
}
} catch (error) {
console.error("Error comparing commits on Claude branch:", error);
// If we can't compare but the branch exists remotely, include the branch link
const branchUrl = `${GITHUB_SERVER_URL}/${owner}/${repo}/tree/${claudeBranch}`;
const branchUrl = `${GITHUB_SERVER_URL}/${owner}/${repo}/tree/${encodeBranchNameForUrl(claudeBranch)}`;
branchLink = `\n[View branch](${branchUrl})`;
}
}
+81 -21
View File
@@ -9,6 +9,8 @@
import { $ } from "bun";
import { execFileSync } from "child_process";
import type { ParsedGitHubContext } from "../context";
import { isPullRequestEvent } from "../context";
import { retryWithBackoff } from "../../utils/retry";
import type { GitHubPullRequest } from "../types";
import type { Octokits } from "../api/client";
import type { FetchDataResult } from "../data/fetcher";
@@ -29,7 +31,7 @@ function extractFirstLabel(githubData: FetchDataResult): string | undefined {
*
* Valid branch names:
* - Start with alphanumeric character, underscore, or @ (not dash, to prevent option injection)
* - Contain only alphanumeric, forward slash, hyphen, underscore, period, hash (#), plus (+), comma (,), or at sign (@)
* - Contain only alphanumeric, forward slash, hyphen, underscore, period, hash (#), plus (+), comma (,), at sign (@), or parentheses
* - Do not start or end with a period
* - Do not end with a slash
* - Do not contain '..' (path traversal)
@@ -60,7 +62,7 @@ export function validateBranchName(branchName: string): void {
);
}
// Strict whitelist pattern: alphanumeric or @ start, then alphanumeric/slash/hyphen/underscore/period/hash/plus/comma/at-sign.
// Strict whitelist pattern: alphanumeric or @ start, then alphanumeric/slash/hyphen/underscore/period/hash/plus/comma/at-sign/parentheses.
// # is valid per git-check-ref-format and commonly used in branch names like "fix/#123-description".
// + is valid per git-check-ref-format and generated by Claude Code's EnterWorktree tool when
// converting worktree names containing "/" (e.g. "feat/foo" becomes "worktree-feat+foo").
@@ -72,12 +74,14 @@ export function validateBranchName(branchName: string): void {
// _ is valid per git-check-ref-format anywhere in a ref name, including the first character;
// leading underscores are a common convention for release/internal branches (e.g.
// "_release/v1.2.3"), which previously failed validation as a PR's base branch.
// Parentheses are valid per git-check-ref-format and commonly appear in branch names that
// use Conventional Commit-style scopes (e.g. "feat(parser)-handle-empty-input").
// All git calls use execFileSync (not shell interpolation), so none of these characters carry injection risk.
const validPattern = /^[a-zA-Z0-9@_][a-zA-Z0-9/_.#+,@-]*$/;
const validPattern = /^[a-zA-Z0-9@_][a-zA-Z0-9/_.#+,@()-]*$/;
if (!validPattern.test(branchName)) {
throw new Error(
`Invalid branch name: "${branchName}". Branch names must start with an alphanumeric character, underscore, or '@' and contain only alphanumeric characters, forward slashes, hyphens, underscores, periods, hashes (#), plus signs (+), commas (,), or at signs (@).`,
`Invalid branch name: "${branchName}". Branch names must start with an alphanumeric character, underscore, or '@' and contain only alphanumeric characters, forward slashes, hyphens, underscores, periods, hashes (#), plus signs (+), commas (,), at signs (@), or parentheses.`,
);
}
@@ -154,6 +158,7 @@ export async function setupBranch(
octokits: Octokits,
githubData: FetchDataResult,
context: ParsedGitHubContext,
triggerTime?: string,
): Promise<BranchInfo> {
const { owner, repo } = context.repository;
const entityNumber = context.entityNumber;
@@ -175,6 +180,7 @@ export async function setupBranch(
console.log("This is an open PR, checking out PR branch...");
const branchName = prData.headRefName;
const headSha = prData.headRefOid;
// Determine optimal fetch depth based on PR commit count, with a minimum
// of 20. Only applied to a checkout that is already shallow — see
@@ -193,25 +199,56 @@ export async function setupBranch(
// Validate branch names before use to prevent command injection
validateBranchName(branchName);
if (!/^[0-9a-f]{40}$/.test(headSha)) {
throw new Error(
`Unexpected head SHA for PR #${entityNumber}: ${headSha}`,
);
}
// For cross-repository (fork) PRs, fetch via the pull ref since the
// branch only exists on the fork's remote, not on origin.
if (prData.isCrossRepository) {
console.log(
`PR #${entityNumber} is from a fork, fetching via refs/pull/${entityNumber}/head...`,
if (isPullRequestEvent(context)) {
const eventSha = context.payload.pull_request.head.sha;
if (eventSha !== headSha) {
throw new Error(
`PR #${entityNumber} was updated after the trigger (${eventSha} -> ${headSha}). Push again or mention Claude to run on the latest version.`,
);
}
} else if (triggerTime) {
if (!prData.headRepository) {
throw new Error(
`PR #${entityNumber}: head repository is not available, cannot pin the PR version`,
);
}
const pushedAt = await headPushedAt(
octokits,
{
owner: prData.headRepository.owner.login,
repo: prData.headRepository.name,
},
branchName,
headSha,
);
if (new Date(pushedAt).getTime() >= new Date(triggerTime).getTime()) {
throw new Error(
`PR #${entityNumber} was updated after the trigger (${pushedAt} >= ${triggerTime}). Mention Claude again to run on the latest version.`,
);
}
}
const localBranch = prData.isCrossRepository
? `pr-${entityNumber}`
: branchName;
console.log(`PR #${entityNumber}: pinning ${localBranch} to ${headSha}`);
execGit(["fetch", "origin", ...depthArgs, headSha]);
execGit(["checkout", "-B", localBranch, headSha, "--"]);
const checkedOut = execFileSync("git", ["rev-parse", "HEAD"], {
encoding: "utf8",
}).trim();
if (checkedOut !== headSha) {
throw new Error(
`PR #${entityNumber}: checked out ${checkedOut}, expected ${headSha}`,
);
execGit([
"fetch",
"origin",
...depthArgs,
`pull/${entityNumber}/head:${branchName}`,
]);
} else {
// Execute git commands to checkout PR branch (dynamic depth based on PR size)
// Using execFileSync instead of shell template literals for security
execGit(["fetch", "origin", ...depthArgs, branchName]);
}
execGit(["checkout", branchName, "--"]);
console.log(`Successfully checked out PR branch for PR #${entityNumber}`);
@@ -221,7 +258,7 @@ export async function setupBranch(
return {
baseBranch,
currentBranch: branchName,
currentBranch: localBranch,
};
}
}
@@ -348,3 +385,26 @@ export async function setupBranch(
process.exit(1);
}
}
async function headPushedAt(
octokits: Octokits,
headRepo: { owner: string; repo: string },
branchName: string,
headSha: string,
): Promise<string> {
const { data } = await retryWithBackoff(() =>
octokits.rest.request("GET /repos/{owner}/{repo}/activity", {
owner: headRepo.owner,
repo: headRepo.repo,
ref: `refs/heads/${branchName}`,
per_page: 1,
}),
);
const latest = (data as Array<{ after: string; timestamp: string }>)[0];
if (!latest || latest.after !== headSha) {
throw new Error(
`Could not determine when ${headSha} was pushed to ${headRepo.owner}/${headRepo.repo}:${branchName}`,
);
}
return latest.timestamp;
}
+2 -1
View File
@@ -1,5 +1,6 @@
import { GITHUB_SERVER_URL } from "../api/config";
import { redactSecrets } from "../utils/sanitizer";
import { encodeBranchNameForUrl } from "./comments/common";
export type ExecutionDetails = {
total_cost_usd?: number;
@@ -161,7 +162,7 @@ export function updateCommentBody(input: CommentUpdateInput): string {
// Extract owner/repo from jobUrl
const repoMatch = jobUrl.match(/github\.com\/([^\/]+)\/([^\/]+)\//);
if (repoMatch) {
branchUrl = `${GITHUB_SERVER_URL}/${repoMatch[1]}/${repoMatch[2]}/tree/${finalBranchName}`;
branchUrl = `${GITHUB_SERVER_URL}/${repoMatch[1]}/${repoMatch[2]}/tree/${encodeBranchNameForUrl(finalBranchName)}`;
}
}
+6 -1
View File
@@ -12,12 +12,17 @@ export function createJobRunLink(
return `[View job run](${jobRunUrl})`;
}
/** Encode Git-ref path segments without turning `/` into `%2F`. */
export function encodeBranchNameForUrl(branchName: string): string {
return branchName.split("/").map(encodeURIComponent).join("/");
}
export function createBranchLink(
owner: string,
repo: string,
branchName: string,
): string {
const branchUrl = `${GITHUB_SERVER_URL}/${owner}/${repo}/tree/${branchName}`;
const branchUrl = `${GITHUB_SERVER_URL}/${owner}/${repo}/tree/${encodeBranchNameForUrl(branchName)}`;
return `\n[View branch](${branchUrl})`;
}
+56 -26
View File
@@ -17,11 +17,18 @@ const PR_NUMBER = process.env.PR_NUMBER;
const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
const RUNNER_TEMP = process.env.RUNNER_TEMP || "/tmp";
if (!REPO_OWNER || !REPO_NAME || !PR_NUMBER || !GITHUB_TOKEN) {
console.error(
"[GitHub CI Server] Error: REPO_OWNER, REPO_NAME, PR_NUMBER, and GITHUB_TOKEN environment variables are required",
);
process.exit(1);
// Job logs are fetched by ID from GitHub-hosted storage; bound the request so a
// stalled fetch can't hang this MCP call forever. Mirrors the timeout added to
// fetchImage() in src/github/utils/image-downloader.ts (#1625).
const DOWNLOAD_JOB_LOG_TIMEOUT_MS = 30_000;
if (import.meta.main) {
if (!REPO_OWNER || !REPO_NAME || !PR_NUMBER || !GITHUB_TOKEN) {
console.error(
"[GitHub CI Server] Error: REPO_OWNER, REPO_NAME, PR_NUMBER, and GITHUB_TOKEN environment variables are required",
);
process.exit(1);
}
}
const server = new McpServer({
@@ -205,6 +212,40 @@ server.tool(
},
);
export async function downloadJobLog(
client: Octokit,
params: { owner: string; repo: string; job_id: number },
runnerTemp: string,
timeoutMs: number = DOWNLOAD_JOB_LOG_TIMEOUT_MS,
): Promise<{ path: string; size_bytes: number }> {
const controller = new AbortController();
const timeoutHandle = setTimeout(() => controller.abort(), timeoutMs);
try {
const response = await client.actions.downloadJobLogsForWorkflowRun({
owner: params.owner,
repo: params.repo,
job_id: params.job_id,
request: { signal: controller.signal },
});
const logsText = response.data as unknown as string;
const logsDir = `${runnerTemp}/github-ci-logs`;
await mkdir(logsDir, { recursive: true });
const logPath = `${logsDir}/job-${params.job_id}.log`;
await writeFile(logPath, logsText, "utf-8");
return {
path: logPath,
size_bytes: Buffer.byteLength(logsText, "utf-8"),
};
} finally {
clearTimeout(timeoutHandle);
}
}
server.tool(
"download_job_log",
"Download job logs to disk",
@@ -218,24 +259,11 @@ server.tool(
baseUrl: GITHUB_API_URL,
});
const response = await client.actions.downloadJobLogsForWorkflowRun({
owner: REPO_OWNER!,
repo: REPO_NAME!,
job_id,
});
const logsText = response.data as unknown as string;
const logsDir = `${RUNNER_TEMP}/github-ci-logs`;
await mkdir(logsDir, { recursive: true });
const logPath = `${logsDir}/job-${job_id}.log`;
await writeFile(logPath, logsText, "utf-8");
const result = {
path: logPath,
size_bytes: Buffer.byteLength(logsText, "utf-8"),
};
const result = await downloadJobLog(
client,
{ owner: REPO_OWNER!, repo: REPO_NAME!, job_id },
RUNNER_TEMP,
);
return {
content: [
@@ -277,6 +305,8 @@ async function runServer() {
}
}
runServer().catch(() => {
process.exit(1);
});
if (import.meta.main) {
runServer().catch(() => {
process.exit(1);
});
}
+24
View File
@@ -0,0 +1,24 @@
import { z } from "zod";
/** Raw shape passed to `server.tool` for commit_files. */
export const commitFilesInputSchema = {
files: z
.array(z.string())
.describe(
'Array of file paths relative to repository root (e.g. ["src/main.js", "README.md"]). All files must exist locally.',
),
message: z.string().describe("Commit message"),
};
/** Raw shape passed to `server.tool` for delete_files. */
export const deleteFilesInputSchema = {
paths: z
.array(z.string())
.describe(
'Array of file paths to delete relative to repository root (e.g. ["src/old-file.js", "docs/deprecated.md"])',
),
message: z.string().describe("Commit message"),
};
export const commitFilesPayloadSchema = z.object(commitFilesInputSchema);
export const deleteFilesPayloadSchema = z.object(deleteFilesInputSchema);
+6 -17
View File
@@ -2,7 +2,6 @@
// GitHub File Operations MCP Server
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
import { readFile, stat } from "fs/promises";
import { resolve } from "path";
import { constants } from "fs";
@@ -11,6 +10,10 @@ import { GITHUB_API_URL } from "../github/api/config";
import { isBinaryContent } from "./binary-detection";
import { validatePathWithinRepo } from "./path-validation";
import { updateGitReference } from "./update-git-reference";
import {
commitFilesInputSchema,
deleteFilesInputSchema,
} from "./github-file-ops-schemas";
type GitHubRef = {
object: {
@@ -197,14 +200,7 @@ async function getFileMode(filePath: string): Promise<string> {
server.tool(
"commit_files",
"Commit one or more files to a repository in a single commit (this will commit them atomically in the remote repository)",
{
files: z
.array(z.string())
.describe(
'Array of file paths relative to repository root (e.g. ["src/main.js", "README.md"]). All files must exist locally.',
),
message: z.string().describe("Commit message"),
},
commitFilesInputSchema,
async ({ files, message }) => {
const owner = REPO_OWNER;
const repo = REPO_NAME;
@@ -414,14 +410,7 @@ server.tool(
server.tool(
"delete_files",
"Delete one or more files from a repository in a single commit",
{
paths: z
.array(z.string())
.describe(
'Array of file paths to delete relative to repository root (e.g. ["src/old-file.js", "docs/deprecated.md"])',
),
message: z.string().describe("Commit message"),
},
deleteFilesInputSchema,
async ({ paths, message }) => {
const owner = REPO_OWNER;
const repo = REPO_NAME;
+30 -2
View File
@@ -14,7 +14,12 @@ import {
extractOriginalBody,
} from "../../github/data/fetcher";
import { createPrompt } from "../../create-prompt";
import { isEntityContext } from "../../github/context";
import {
isEntityContext,
isIssueCommentEvent,
isPullRequestReviewCommentEvent,
} from "../../github/context";
import { updateClaudeComment } from "../../github/operations/comments/update-claude-comment";
import type { GitHubContext } from "../../github/context";
import type { Octokits } from "../../github/api/client";
import { parseAllowedTools } from "../agent/parse-tools";
@@ -64,7 +69,30 @@ export async function prepareTagMode({
});
// Setup branch
const branchInfo = await setupBranch(octokit, githubData, context);
const editedAt =
context.eventAction === "edited" &&
(isIssueCommentEvent(context) || isPullRequestReviewCommentEvent(context))
? context.payload.comment.updated_at
: undefined;
let branchInfo;
try {
branchInfo = await setupBranch(
octokit,
githubData,
context,
editedAt || triggerTime,
);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
await updateClaudeComment(octokit.rest, {
owner: context.repository.owner,
repo: context.repository.repo,
commentId,
body: message,
isPullRequestReviewComment: isPullRequestReviewCommentEvent(context),
}).catch((e) => console.error(`Failed to update tracking comment: ${e}`));
throw error;
}
// Configure git authentication
// SSH signing takes precedence if provided
+6
View File
@@ -36,6 +36,12 @@ describe("comments/common", () => {
);
});
test("encodes URL-significant characters in a branch name", () => {
expect(createBranchLink("o", "r", "claude/fix#123")).toBe(
`\n[View branch](${GITHUB_SERVER_URL}/o/r/tree/claude/fix%23123)`,
);
});
test("prefixes the link with a newline so it renders on its own line", () => {
expect(createBranchLink("o", "r", "main").startsWith("\n")).toBe(true);
});
+6
View File
@@ -819,6 +819,12 @@ describe("generatePrompt", () => {
// Should have commit signing tool instructions
expect(prompt).toContain("mcp__github_file_ops__commit_files");
expect(prompt).toContain("mcp__github_file_ops__delete_files");
expect(prompt).toContain(
'mcp__github_file_ops__delete_files: {"paths": ["path/to/old.js"]',
);
expect(prompt).not.toContain(
'mcp__github_file_ops__delete_files: {"files":',
);
// Comment tool should always be from comment server, not file ops
expect(prompt).toContain("mcp__github_comment__update_claude_comment");
+169
View File
@@ -0,0 +1,169 @@
#!/usr/bin/env bun
import { describe, expect, test, beforeAll } from "bun:test";
import { generatePrompt } from "../src/create-prompt";
import type { PreparedContext } from "../src/create-prompt";
import {
commitFilesPayloadSchema,
deleteFilesPayloadSchema,
} from "../src/mcp/github-file-ops-schemas";
beforeAll(() => {
process.env.GITHUB_ACTION_PATH = "/test/action/path";
});
const mockGitHubData = {
contextData: {
title: "Test PR",
body: "This is a test PR",
author: { login: "testuser" },
state: "OPEN",
labels: { nodes: [] },
createdAt: "2023-01-01T00:00:00Z",
additions: 15,
deletions: 5,
baseRefName: "main",
headRefName: "feature-branch",
headRefOid: "abc123",
isCrossRepository: false,
headRepository: { owner: { login: "testowner" }, name: "testrepo" },
commits: { totalCount: 0, nodes: [] },
files: { nodes: [] },
comments: { nodes: [] },
reviews: { nodes: [] },
},
comments: [],
changedFiles: [],
changedFilesWithSHA: [],
reviewData: null,
imageUrlMap: new Map<string, string>(),
};
const signingContext: PreparedContext = {
repository: "owner/repo",
claudeCommentId: "12345",
triggerPhrase: "@claude",
eventData: {
eventName: "issue_comment",
commentId: "67890",
isPR: true,
prNumber: "123",
commentBody: "@claude delete the old file",
},
};
function extractToolExample(
prompt: string,
tool: string,
): Record<string, unknown> {
const match = prompt.match(
new RegExp(
`${tool.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}:\\s*(\\{[^}]+\\})`,
),
);
if (!match) {
throw new Error(`No JSON example for ${tool} in prompt`);
}
return JSON.parse(match[1] as string);
}
describe("delete_files prompt vs live MCP schema (#1665)", () => {
test("the payload the old prompt taught is rejected by the tool schema", () => {
const taughtByOldPrompt = {
files: ["path/to/old.js"],
message: "chore: remove deprecated file",
};
const result = deleteFilesPayloadSchema.safeParse(taughtByOldPrompt);
expect(result.success).toBe(false);
if (!result.success) {
const fields = result.error.issues.map((issue) => issue.path.join("."));
expect(fields).toContain("paths");
}
});
test("the payload the new prompt teaches is accepted by the tool schema", () => {
const taughtByNewPrompt = {
paths: ["path/to/old.js"],
message: "chore: remove deprecated file",
};
const result = deleteFilesPayloadSchema.safeParse(taughtByNewPrompt);
expect(result.success).toBe(true);
});
test("generated tag-mode prompt example parses against the live schema", async () => {
const prompt = await generatePrompt(
signingContext,
mockGitHubData,
true,
"tag",
);
const example = extractToolExample(
prompt,
"mcp__github_file_ops__delete_files",
);
expect(example).toHaveProperty("paths");
expect(example).not.toHaveProperty("files");
const result = deleteFilesPayloadSchema.safeParse(example);
expect(result.success).toBe(true);
});
test("rejects paths when the value is a string instead of an array", () => {
const result = deleteFilesPayloadSchema.safeParse({
paths: "path/to/old.js",
message: "chore: remove deprecated file",
});
expect(result.success).toBe(false);
});
test("rejects a payload that has paths but omits message", () => {
const result = deleteFilesPayloadSchema.safeParse({
paths: ["path/to/old.js"],
});
expect(result.success).toBe(false);
if (!result.success) {
expect(
result.error.issues.map((issue) => issue.path.join(".")),
).toContain("message");
}
});
test("accepts a payload that still includes the old files key beside paths", () => {
const result = deleteFilesPayloadSchema.safeParse({
files: ["path/to/old.js"],
paths: ["path/to/old.js"],
message: "chore: remove deprecated file",
});
expect(result.success).toBe(true);
});
test("does not change commit_files — that sibling tool still requires files", async () => {
const prompt = await generatePrompt(
signingContext,
mockGitHubData,
true,
"tag",
);
const example = extractToolExample(
prompt,
"mcp__github_file_ops__commit_files",
);
expect(example).toHaveProperty("files");
expect(example).not.toHaveProperty("paths");
expect(commitFilesPayloadSchema.safeParse(example).success).toBe(true);
expect(deleteFilesPayloadSchema.safeParse(example).success).toBe(false);
});
test("generated delete_files example keys are exactly paths and message", async () => {
const prompt = await generatePrompt(
signingContext,
mockGitHubData,
true,
"tag",
);
const example = extractToolExample(
prompt,
"mcp__github_file_ops__delete_files",
);
expect(Object.keys(example).sort()).toEqual(["message", "paths"]);
});
});
+94
View File
@@ -0,0 +1,94 @@
import { describe, test, expect, afterEach } from "bun:test";
import { readFile, rm } from "fs/promises";
import os from "os";
import path from "path";
import { downloadJobLog } from "../src/mcp/github-actions-server";
import type { Octokit } from "@octokit/rest";
describe("downloadJobLog", () => {
const tmpDirs: string[] = [];
const makeRunnerTemp = () => {
const dir = path.join(
os.tmpdir(),
`download-job-log-test-${Date.now()}-${Math.random().toString(36).slice(2)}`,
);
tmpDirs.push(dir);
return dir;
};
afterEach(async () => {
while (tmpDirs.length) {
const dir = tmpDirs.pop()!;
await rm(dir, { recursive: true, force: true });
}
});
const createStallingClient = (): {
client: Octokit;
getSignal: () => AbortSignal | undefined;
} => {
let signal: AbortSignal | undefined;
const client = {
actions: {
downloadJobLogsForWorkflowRun: (params: {
request?: { signal?: AbortSignal };
}) => {
signal = params.request?.signal;
return new Promise((_resolve, reject) => {
signal?.addEventListener("abort", () => {
reject(new Error("This operation was aborted"));
});
// Otherwise never settles, simulating a stalled fetch.
});
},
},
} as unknown as Octokit;
return { client, getSignal: () => signal };
};
test("rejects with a timeout instead of hanging when the download stalls", async () => {
const { client, getSignal } = createStallingClient();
const runnerTemp = makeRunnerTemp();
await expect(
downloadJobLog(
client,
{ owner: "owner", repo: "repo", job_id: 123 },
runnerTemp,
5,
),
).rejects.toThrow();
expect(getSignal()?.aborted).toBe(true);
});
test("writes the log to disk and clears the timeout when the download succeeds", async () => {
const runnerTemp = makeRunnerTemp();
const client = {
actions: {
downloadJobLogsForWorkflowRun: async (params: {
request?: { signal?: AbortSignal };
}) => {
expect(params.request?.signal?.aborted).toBe(false);
return { data: "log line 1\nlog line 2\n" };
},
},
} as unknown as Octokit;
const result = await downloadJobLog(
client,
{ owner: "owner", repo: "repo", job_id: 456 },
runnerTemp,
30_000,
);
expect(result.path).toBe(`${runnerTemp}/github-ci-logs/job-456.log`);
expect(result.size_bytes).toBe(
Buffer.byteLength("log line 1\nlog line 2\n", "utf-8"),
);
const written = await readFile(result.path, "utf-8");
expect(written).toBe("log line 1\nlog line 2\n");
});
});
+9
View File
@@ -29,6 +29,15 @@ describe("validateBranchName", () => {
expect(() => validateBranchName("release.1.2.3")).not.toThrow();
});
it("should accept branch names containing parentheses", () => {
expect(() =>
validateBranchName("feat(example)-valid-branch"),
).not.toThrow();
expect(() =>
validateBranchName("fix(parser)-handle-empty-input"),
).not.toThrow();
});
it("should accept typical branch name formats", () => {
expect(() =>
validateBranchName("claude/issue-123-20250101-1234"),