Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/claude-wif-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Test Claude Code WIF Auth

on:
issue_comment:
types: [created]
workflow_dispatch: {}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

permissions:
id-token: write
contents: read
pull-requests: read

jobs:
test-wif:
if: >-
github.event_name == 'workflow_dispatch' ||
(github.event.issue.pull_request &&
contains(github.event.comment.body, '/test-wif') &&
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'OWNER')
runs-on: arc-runner-set
timeout-minutes: 10
steps:
- name: Get PR ref
if: github.event_name == 'issue_comment'
id: pr
env:
GH_TOKEN: ${{ github.token }}
run: |
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }})
echo "ref=$(echo "$PR_DATA" | jq -r '.head.sha')" >> "$GITHUB_OUTPUT"
echo "repo=$(echo "$PR_DATA" | jq -r '.head.repo.full_name')" >> "$GITHUB_OUTPUT"

- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
ref: ${{ steps.pr.outputs.ref || github.sha }}
repository: ${{ steps.pr.outputs.repo || github.repository }}
persist-credentials: false

- name: Install Claude Code
run: |
curl -fsSL https://claude.ai/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Authenticate to GCP via WIF
uses: google-github-actions/auth@c200f3691d83b41bf9bbd8638997a462592937ed # v2
with:
project_id: hosted-control-planes
service_account: claude-gha@hosted-control-planes.iam.gserviceaccount.com
workload_identity_provider: projects/21066242673/locations/global/workloadIdentityPools/itpc-identity-pool/providers/github.com

- name: Test Claude Code
env:
CLAUDE_CODE_USE_VERTEX: "1"
CLOUD_ML_REGION: global
ANTHROPIC_VERTEX_PROJECT_ID: hosted-control-planes
run: |
claude --version
claude -p "Say hello in one sentence" --max-turns 1