|
16 | 16 | permissions: |
17 | 17 | contents: read |
18 | 18 | pull-requests: write |
| 19 | + id-token: write # Anthropic Workload Identity Federation |
19 | 20 |
|
20 | 21 | jobs: |
21 | 22 | test-notebooks: |
@@ -126,9 +127,14 @@ jobs: |
126 | 127 | github.event_name == 'pull_request' && |
127 | 128 | steps.changed-notebooks.outputs.has_notebooks == 'true' && |
128 | 129 | steps.structure-tests.outputs.has_failures == 'true' |
129 | | - uses: anthropics/claude-code-action@v1 |
| 130 | + uses: anthropics/claude-code-action@bbfaf8e1ffe3e688f7ab65ceee78de241e24a238 # v1.0.132 (>=v1.0.130 for WIF inputs) |
130 | 131 | with: |
131 | | - anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
| 132 | + # Anthropic auth via Workload Identity Federation — the action |
| 133 | + # exchanges this job's GitHub OIDC token (id-token: write above) |
| 134 | + # for a short-lived access token instead of a static API key. |
| 135 | + anthropic_federation_rule_id: fdrl_01SqmTwzmEE547mtaYN1mqHL |
| 136 | + anthropic_organization_id: 1ec12c5c-6542-4da8-bf2f-c15919aef01c |
| 137 | + anthropic_service_account_id: svac_01BHcCBa1UWFvNrHMqJjuaUZ |
132 | 138 | github_token: ${{ secrets.GITHUB_TOKEN }} |
133 | 139 | prompt: | |
134 | 140 | The notebook tests found issues in the changed notebooks. |
@@ -157,6 +163,11 @@ jobs: |
157 | 163 | env: |
158 | 164 | PR_NUMBER: ${{ github.event.pull_request.number }} |
159 | 165 |
|
| 166 | + # TODO: this step still reads the static ANTHROPIC_API_KEY secret. The |
| 167 | + # claude-code-action step above uses Workload Identity Federation; this |
| 168 | + # direct-API step needs a separate inline OIDC mint+exchange (or the |
| 169 | + # anthropic SDK's WIF env-var trio). Gracefully skips when the secret |
| 170 | + # is absent (the `[ -z "$ANTHROPIC_API_KEY" ]` guard below). |
160 | 171 | - name: Run notebook execution tests (maintainers only) |
161 | 172 | id: execution-tests |
162 | 173 | if: | |
|
0 commit comments