ci(claude-translator): add github_token to workflow for authentication (#10053)

* ci(claude-translator): add github_token to workflow for authentication

* ci(workflows): restrict code review to main repo PRs

Fix OIDC issues by only triggering reviews for PRs from the main repository

* ci(workflows): re-enable issues trigger for claude translator

The upstream bug has been fixed, so we can now re-enable the issues trigger.
Also update the claude-code-action to use main branch instead of v1 tag.
This commit is contained in:
Phantom 2025-09-09 20:32:41 +08:00 committed by GitHub
parent 0c589a6f79
commit 493b0d4a11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 13 deletions

View File

@ -12,12 +12,9 @@ on:
jobs:
claude-review:
# Optional: Filter by PR author
# if: |
# github.event.pull_request.user.login == 'external-contributor' ||
# github.event.pull_request.user.login == 'new-developer' ||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
# Only trigger code review for PRs from the main repository due to upstream OIDC issues
# https://github.com/anthropics/claude-code-action/issues/542
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: read

View File

@ -4,18 +4,15 @@ concurrency:
cancel-in-progress: false
on:
# temporally disable this because upstream bug.
# issues:
# types: [opened]
issues:
types: [opened]
issue_comment:
types: [created, edited]
jobs:
translate:
# disable issues for now because upstream bug
# (github.event_name == 'issues' && github.event.issue.author_association == 'COLLABORATOR' && !contains(github.event.issue.body, 'This issue was translated by Claude.')) ||
if: |
(github.event_name == 'issues') ||
(github.event_name == 'issue_comment' && github.event.sender.type != 'Bot') &&
((github.event_name == 'issue_comment' && github.event.action == 'created' && !contains(github.event.comment.body, 'This issue was translated by Claude')) ||
(github.event_name == 'issue_comment' && github.event.action == 'edited'))
@ -33,9 +30,10 @@ jobs:
fetch-depth: 1
- name: Run Claude for translation
uses: anthropics/claude-code-action@v1
uses: anthropics/claude-code-action@main
id: claude
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
claude_args: '--allowed-tools Bash(gh issue:*),Bash(gh api:repos/*/issues:*)'
prompt: |