File tree Expand file tree Collapse file tree
actions/github/branch-protection Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,14 +5,17 @@ inputs:
55 branch :
66 description : ' Branch name to lock.'
77 required : true
8+ token :
9+ description : ' GitHub token with administration:write (repo admin) permission. Use a PAT; GITHUB_TOKEN cannot call the branch protection API.'
10+ required : true
811
912runs :
1013 using : composite
1114 steps :
1215 - name : ' Lock branch ${{ inputs.branch }}'
1316 shell : bash
1417 env :
15- GH_TOKEN : ${{ github .token }}
18+ GH_TOKEN : ${{ inputs .token }}
1619 run : |
1720 if ! gh api --method PUT /repos/${{ github.repository }}/branches/${{ inputs.branch }}/protection \
1821 --input - << 'EOF'
Original file line number Diff line number Diff line change @@ -5,14 +5,17 @@ inputs:
55 branch :
66 description : ' Branch name to unlock.'
77 required : true
8+ token :
9+ description : ' GitHub token with administration:write (repo admin) permission. Use a PAT; GITHUB_TOKEN cannot call the branch protection API.'
10+ required : true
811
912runs :
1013 using : composite
1114 steps :
1215 - name : ' Unlock branch ${{ inputs.branch }}'
1316 shell : bash
1417 env :
15- GH_TOKEN : ${{ github .token }}
18+ GH_TOKEN : ${{ inputs .token }}
1619 run : |
1720 gh api --method DELETE /repos/${{ github.repository }}/branches/${{ inputs.branch }}/protection || true
1821 echo "🔓 Branch protection removed from '${{ inputs.branch }}'." >> $GITHUB_STEP_SUMMARY
Original file line number Diff line number Diff line change @@ -216,6 +216,7 @@ jobs:
216216 uses : ' ./.github/actions/github/branch-protection/lock'
217217 with :
218218 branch : ${{ needs.workflow-variables.outputs.target-branch }}
219+ token : ${{ secrets.GH_ADMIN_TOKEN }}
219220 - name : ' Create PR: "Promote ${{ env.current-branch }} to ${{ env.target-branch }}"'
220221 if : ${{ needs.workflow-variables.outputs.pull-request-exists == 'false' }}
221222 env :
Original file line number Diff line number Diff line change @@ -357,6 +357,7 @@ jobs:
357357 uses : ' ./.github/actions/github/branch-protection/lock'
358358 with :
359359 branch : ${{ steps.resolve-support-branch.outputs.support-branch }}
360+ token : ${{ secrets.GH_ADMIN_TOKEN }}
360361
361362 - name : ' Write support branch summary'
362363 run : |
You can’t perform that action at this time.
0 commit comments