You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/actions/github/branch-protection/lock/action.yml
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ runs:
14
14
env:
15
15
GH_TOKEN: ${{ github.token }}
16
16
run: |
17
-
gh api --method PUT /repos/${{ github.repository }}/branches/${{ inputs.branch }}/protection \
17
+
if ! gh api --method PUT /repos/${{ github.repository }}/branches/${{ inputs.branch }}/protection \
18
18
--input - << 'EOF'
19
19
{
20
20
"required_status_checks": null,
@@ -30,4 +30,8 @@ runs:
30
30
"lock_branch": false
31
31
}
32
32
EOF
33
+
then
34
+
echo "::error::Failed to apply branch protection to '${{ inputs.branch }}'. Ensure the token has 'administration: write' permission and the branch exists."
35
+
exit 1
36
+
fi
33
37
echo "🔒 Branch '${{ inputs.branch }}' is now protected." >> $GITHUB_STEP_SUMMARY
0 commit comments