mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-09-14 21:59:09 +02:00
fix(ci): pass github_token to claude-code-action so AI workflows can auth (#2908)
Every claude-code-action step except on_claude_mention.yml left the github_token input unset, so the action fell back to the OIDC -> Claude App token exchange. That exchange requires github.actor to have write access on the repo; on an issues.opened event the actor is the outside reporter, so it always 401'd. Classify is continue-on-error, so the job went green while doing nothing. Setting the input short-circuits the exchange (action.yml maps it to OVERRIDE_GITHUB_TOKEN; token.ts returns it before requesting OIDC). GITHUB_TOKEN for the read-only classifier; AI_PR_TOKEN for the three that push branches or open PRs, so the resulting PR triggers CI. Also dropped the workflow-level id-token: write grant, which is unreachable once github_token is set (CodeRabbit).
This commit is contained in:
6
.github/workflows/daily_ai_fix.yaml
vendored
6
.github/workflows/daily_ai_fix.yaml
vendored
@@ -50,7 +50,6 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
id-token: write # claude-code-action fetches a GitHub OIDC token to auth the OAuth flow
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ai-fix-sweep
|
group: ai-fix-sweep
|
||||||
@@ -129,6 +128,11 @@ jobs:
|
|||||||
uses: anthropics/claude-code-action@44423bdec74b97d67543eb16c110546762c110b2 # v1
|
uses: anthropics/claude-code-action@44423bdec74b97d67543eb16c110546762c110b2 # v1
|
||||||
with:
|
with:
|
||||||
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||||
|
# Skip the OIDC -> Claude App token exchange. The scheduled path
|
||||||
|
# happens to pass it (github.actor is the maintainer), but
|
||||||
|
# workflow_dispatch by anyone else would 401. AI_PR_TOKEN, not
|
||||||
|
# GITHUB_TOKEN, so a PR Claude opens triggers CI.
|
||||||
|
github_token: ${{ secrets.AI_PR_TOKEN }}
|
||||||
# One sticky, auto-updating status comment per run instead of the
|
# One sticky, auto-updating status comment per run instead of the
|
||||||
# model narrating its own progress in scattered comments.
|
# model narrating its own progress in scattered comments.
|
||||||
track_progress: true
|
track_progress: true
|
||||||
|
|||||||
5
.github/workflows/on_issue_approved.yaml
vendored
5
.github/workflows/on_issue_approved.yaml
vendored
@@ -32,7 +32,6 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
id-token: write # claude-code-action fetches a GitHub OIDC token to auth the OAuth flow
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ai-approve-${{ github.event.issue.number || inputs.issue }}
|
group: ai-approve-${{ github.event.issue.number || inputs.issue }}
|
||||||
@@ -139,6 +138,10 @@ jobs:
|
|||||||
uses: anthropics/claude-code-action@44423bdec74b97d67543eb16c110546762c110b2 # v1
|
uses: anthropics/claude-code-action@44423bdec74b97d67543eb16c110546762c110b2 # v1
|
||||||
with:
|
with:
|
||||||
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||||
|
# Skip the OIDC -> Claude App token exchange, which 401s whenever
|
||||||
|
# github.actor lacks write access. AI_PR_TOKEN, not GITHUB_TOKEN, so
|
||||||
|
# a PR Claude opens triggers CI.
|
||||||
|
github_token: ${{ secrets.AI_PR_TOKEN }}
|
||||||
track_progress: true
|
track_progress: true
|
||||||
prompt: |
|
prompt: |
|
||||||
The approved plan is /tmp/ai-exec/plan.md and the issue it belongs
|
The approved plan is /tmp/ai-exec/plan.md and the issue it belongs
|
||||||
|
|||||||
7
.github/workflows/on_issues_ai_triage.yaml
vendored
7
.github/workflows/on_issues_ai_triage.yaml
vendored
@@ -41,7 +41,6 @@ on:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
issues: write
|
issues: write
|
||||||
id-token: write # claude-code-action fetches a GitHub OIDC token to auth the OAuth flow
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ai-triage-${{ github.event.issue.number || inputs.issue || github.run_id }}
|
group: ai-triage-${{ github.event.issue.number || inputs.issue || github.run_id }}
|
||||||
@@ -148,6 +147,12 @@ jobs:
|
|||||||
uses: anthropics/claude-code-action@44423bdec74b97d67543eb16c110546762c110b2 # v1
|
uses: anthropics/claude-code-action@44423bdec74b97d67543eb16c110546762c110b2 # v1
|
||||||
with:
|
with:
|
||||||
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||||
|
# Without this the action falls back to the OIDC -> Claude App token
|
||||||
|
# exchange, which 401s ("User does not have write access on this
|
||||||
|
# repository") whenever github.actor is the outside reporter who
|
||||||
|
# opened the issue or replied to a needs-info request. Same token the
|
||||||
|
# step already exports as GH_TOKEN; classify only reads.
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
show_full_output: true
|
show_full_output: true
|
||||||
prompt: |
|
prompt: |
|
||||||
Read /tmp/ai-triage/context.md, then follow the instructions in
|
Read /tmp/ai-triage/context.md, then follow the instructions in
|
||||||
|
|||||||
6
.github/workflows/on_pr_coderabbit.yml
vendored
6
.github/workflows/on_pr_coderabbit.yml
vendored
@@ -25,7 +25,6 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
issues: write
|
issues: write
|
||||||
id-token: write # claude-code-action fetches a GitHub OIDC token to auth the OAuth flow
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ai-coderabbit-${{ github.event.pull_request.number }}
|
group: ai-coderabbit-${{ github.event.pull_request.number }}
|
||||||
@@ -83,6 +82,11 @@ jobs:
|
|||||||
uses: anthropics/claude-code-action@44423bdec74b97d67543eb16c110546762c110b2 # v1
|
uses: anthropics/claude-code-action@44423bdec74b97d67543eb16c110546762c110b2 # v1
|
||||||
with:
|
with:
|
||||||
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||||
|
# Skip the OIDC -> Claude App token exchange, which 401s whenever
|
||||||
|
# github.actor lacks write access — here github.actor is
|
||||||
|
# coderabbitai[bot], the review submitter. AI_PR_TOKEN, not
|
||||||
|
# GITHUB_TOKEN, so the pushed fixes re-trigger CI on the PR.
|
||||||
|
github_token: ${{ secrets.AI_PR_TOKEN }}
|
||||||
prompt: |
|
prompt: |
|
||||||
CodeRabbit has reviewed pull request #${{ github.event.pull_request.number }}
|
CodeRabbit has reviewed pull request #${{ github.event.pull_request.number }}
|
||||||
on ${{ github.repository }}. You are on that PR's branch. Follow
|
on ${{ github.repository }}. You are on that PR's branch. Follow
|
||||||
|
|||||||
Reference in New Issue
Block a user