skills/github-agent-actions/SKILL.md
Create GitHub Actions workflows powered by claude-code-action. Fetches current docs to stay accurate, applies a structured checklist to avoid common pitfalls, and produces working workflows.
npx skillsauth add cartridge-gg/agents github-agent-actionsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create GitHub Actions workflows that use anthropics/claude-code-action to automate PR reviews, issue triage, documentation updates, scheduled maintenance, and other Claude-powered tasks.
The claude-code-action repo is the authoritative source for supported inputs, events, and configuration. When in doubt, fetch what you need before generating YAML.
gh api repos/anthropics/claude-code-action/contents/action.yml --jq '.content' | base64 -dgh api repos/anthropics/claude-code-action/contents/src/github/context.ts --jq '.content' | base64 -dgh api repos/anthropics/claude-code-action/contents/docs/solutions.md --jq '.content' | base64 -dgh api repos/anthropics/claude-code-action/contents/docs/migration-guide.md --jq '.content' | base64 -dDetermine what the user wants:
pull_request_target instead of pull_request so the workflow has access to repo secrets.For simple requests, proceed directly to generation. For complex workflows, ask 1-2 clarifying questions first.
Before generating YAML, fetch the action's action.yml to confirm:
@v1 unless the user specifies otherwise)If the workflow uses an unusual trigger event, also fetch context.ts to confirm it's in the supported event switch statement.
Verify each of these internally before writing any YAML.
contents: readcontents: writepull-requests: writeissues: writeid-token: writeThe action needs two credentials: an Anthropic API key (to call Claude) and a GitHub token (to comment on PRs, read code, etc.). The GitHub token has two paths — understanding which one applies is critical:
Default path (OIDC + Anthropic GitHub App): The action requests an OIDC token from GitHub, then exchanges it with Anthropic's service for a GitHub App installation token.
This requires the repo to have Anthropic's GitHub App installed.
If the App is not installed, this fails with Invalid OIDC token.
This path requires id-token: write permission.
Override path (github_token input): If you pass github_token, the action skips OIDC entirely and uses that token directly.
The built-in ${{ github.token }} (aka ${{ secrets.GITHUB_TOKEN }}) already has the permissions declared in the workflow's permissions: block.
Decision rule: If the repo has Anthropic's GitHub App installed, use the default path.
Otherwise, pass github_token: ${{ github.token }} to bypass OIDC:
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ github.token }}
Security tradeoff between the two paths:
The GitHub App path adds a validation layer — Anthropic's service verifies the OIDC token and can enforce policies on which repos/workflows are allowed before issuing a scoped token.
With github_token, you skip that gatekeeper.
When using github_token with pull_request_target (the common fork PR pattern):
AGENTS.md or CLAUDE.md that tries to trick Claude into misusing available tools — e.g., exfiltrating the Anthropic API key or posting spam via gh.Mitigations when using github_token + pull_request_target:
--allowedTools in claude_args to only what the workflow needs--disallowedTools (e.g., Bash(gh pr merge:*))--max-turns low to limit the blast radiuspull_request from a fork will have empty secret values — including secrets.ANTHROPIC_API_KEY.
Use pull_request_target if you need secrets for fork PRs. This runs the workflow from the base branch with access to the base repo's secrets.
Security tradeoff: The workflow has access to secrets while potentially processing untrusted code. Never checkout and execute fork code in a pull_request_target workflow without careful review.environment: <name> or the secret will be empty with no error.run: blocks. Use env: to pass them:
# WRONG — secret can leak in logs or process table
- run: curl -H "Authorization: Bearer ${{ secrets.TOKEN }}" ...
# RIGHT
- run: curl -H "Authorization: Bearer $TOKEN" ...
env:
TOKEN: ${{ secrets.TOKEN }}
run: blocks either.
Properties like github.event.pull_request.title, github.event.issue.body, github.event.comment.body, and github.event.head_commit.message can contain shell metacharacters that enable arbitrary command injection.
Use env: — the same pattern as secrets:
# WRONG — attacker can inject shell commands via PR title
- run: echo "${{ github.event.pull_request.title }}"
# RIGHT
- run: echo "$TITLE"
env:
TITLE: ${{ github.event.pull_request.title }}
prompt is set), Claude does NOT automatically receive PR/issue context.
You MUST include relevant context variables in the prompt:
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
--allowedTools in claude_args.Generate a complete .github/workflows/<name>.yml file following this structure:
name: <Descriptive Workflow Name>
on:
<trigger>:
types: [<activity_types>]
jobs:
<job-id>:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
<scope>: <read|write>
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ github.token }} # omit if Anthropic's GitHub App is installed
prompt: |
REPO: ${{ github.repository }}
<additional context>
<instructions>
claude_args: |
<flags>
Key structural rules:
timeout-minutes at the job levelfetch-depth: 1 unless full history is neededref: ${{ github.event.pull_request.head.ref }}pull_request_target, the checkout gets the base branch by default — explicitly checkout the PR head if you need the fork's code (with caution about untrusted code)workflow_run artifacts as untrusted. When splitting into an unprivileged pull_request workflow and a privileged workflow_run workflow, a malicious PR can poison artifacts uploaded during the first stage.
In the privileged workflow_run job: validate artifact contents, unzip to /tmp (not the workspace), and never execute artifact contents as code.After generating, review against these principles:
action.yml. If you didn't fetch it, fetch it now and verify.${{ github.run_id }} or timestamps, never date-only formats.git push origin HEAD, never bare git push.env: blocks.When a workflow fails, diagnose systematically:
action.yml for the version in use and confirm every input name is valid.run: echo '${{ toJson(github.event) }}' to see what context is actually available.| Symptom | Likely Cause | Fix |
|---|---|---|
| Resource not accessible by integration | Missing permission scope | Add the required permission at job level |
| 403 on git push | Missing contents: write | Add contents: write to job permissions |
| Secret value is empty (no error) | Fork PR, wrong scope, or typo in secret name | Check: is this a fork PR? Is the secret scoped to an environment the job doesn't declare? Does the name match exactly? |
| Invalid OIDC token | Anthropic's GitHub App is not installed on the repo | Pass github_token: ${{ github.token }} to bypass OIDC exchange |
| Error: OIDC token request failed | Missing id-token: write permission | Add id-token: write to job permissions (only needed if using default OIDC path) |
| Unsupported event type | Trigger not handled by claude-code-action | Fetch context.ts to confirm supported events |
| Claude posts no comment / takes no action | Missing context in prompt | In automation mode, Claude doesn't receive PR/issue context automatically — add ${{ github.event.pull_request.number }} etc. to the prompt |
testing
Create or update a PR from current branch to main, watch CI, and address feedback
testing
Conduct a focused technical planning interview to produce an implementable, parallelizable plan or spec with clear dependencies, risks, and open questions.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.