File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -276,6 +276,7 @@ jobs:
276276 needs : [validate, provenance]
277277 if : inputs.github
278278 runs-on : ubuntu-latest
279+ environment : github
279280 permissions :
280281 contents : write
281282 actions : read
@@ -292,7 +293,10 @@ jobs:
292293 - name : Create or update exact GitHub release
293294 shell : bash
294295 env :
295- GH_TOKEN : ${{ github.token }}
296+ # Organization policy may cap GITHUB_TOKEN at read-only even when this
297+ # job requests contents: write. A fine-grained token scoped to this
298+ # repository provides the protected-environment fallback.
299+ GH_TOKEN : ${{ secrets.GH_RELEASE_TOKEN || github.token }}
296300 TAG : ${{ inputs.tag }}
297301 VERSION : ${{ needs.validate.outputs.version }}
298302 PRERELEASE : ${{ needs.validate.outputs.is_prerelease }}
Original file line number Diff line number Diff line change @@ -243,8 +243,12 @@ def test_distribution_provenance_source_and_no_build_contracts(self):
243243 self .assertEqual (publish_step ["env" ]["NODE_AUTH_TOKEN" ], "${{ secrets.NPM_TOKEN }}" )
244244 self .assertIn ("npm publish \" $tarball\" --access public --provenance" , publish_step ["run" ])
245245 self .assertLess (text .index ('for file in "${platform_tarballs[@]}"' ), text .index ('publish "${roots[0]}"' ))
246- self .assertEqual (release ["jobs" ]["github-release" ]["steps" ][0 ]["uses" ], "actions/checkout@v6" )
247- self .assertEqual (release ["jobs" ]["github-release" ]["steps" ][0 ]["with" ]["ref" ], "${{ inputs.tag }}" )
246+ github = release ["jobs" ]["github-release" ]
247+ self .assertEqual (github ["environment" ], "github" )
248+ self .assertEqual (github ["steps" ][0 ]["uses" ], "actions/checkout@v6" )
249+ self .assertEqual (github ["steps" ][0 ]["with" ]["ref" ], "${{ inputs.tag }}" )
250+ release_step = next (step for step in github ["steps" ] if step .get ("name" ) == "Create or update exact GitHub release" )
251+ self .assertEqual (release_step ["env" ]["GH_TOKEN" ], "${{ secrets.GH_RELEASE_TOKEN || github.token }}" )
248252 self .assertIn ('gh release create "$TAG" "${files[@]}" --verify-tag --target "$SHA"' , text )
249253 self .assertIn ('test "$(jq -r .target_commitish <<<"$release_json")" = "$SHA"' , text )
250254 self .assertNotIn (".head_branch" , text )
You can’t perform that action at this time.
0 commit comments