Skip to content

Commit 0fdc584

Browse files
refactor: Remove branch protection API calls from release workflow (#5376)
Branch protection for core/X.XX branches will now be managed through GitHub repository rulesets with wildcard pattern matching, providing more consistent and centralized protection rule management.
1 parent 0bc53eb commit 0fdc584

File tree

1 file changed

+0
-39
lines changed

1 file changed

+0
-39
lines changed

.github/workflows/create-release-candidate-branch.yaml

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -128,45 +128,6 @@ jobs:
128128
echo "- Critical security patches"
129129
echo "- Documentation updates"
130130
131-
- name: Create branch protection rules
132-
if: steps.check_version.outputs.is_minor_bump == 'true' && env.branch_exists != 'true'
133-
env:
134-
GITHUB_TOKEN: ${{ secrets.PR_GH_TOKEN || secrets.GITHUB_TOKEN }}
135-
run: |
136-
BRANCH_NAME="${{ steps.check_version.outputs.branch_name }}"
137-
138-
# Create branch protection using GitHub API
139-
echo "Setting up branch protection for $BRANCH_NAME..."
140-
141-
RESPONSE=$(curl -s -w "\n%{http_code}" -X PUT \
142-
-H "Authorization: token $GITHUB_TOKEN" \
143-
-H "Accept: application/vnd.github.v3+json" \
144-
"https://api.github.com/repos/${{ github.repository }}/branches/$BRANCH_NAME/protection" \
145-
-d '{
146-
"required_status_checks": {
147-
"strict": true,
148-
"contexts": ["lint-and-format", "test", "playwright-tests"]
149-
},
150-
"enforce_admins": false,
151-
"required_pull_request_reviews": {
152-
"required_approving_review_count": 1,
153-
"dismiss_stale_reviews": true
154-
},
155-
"restrictions": null,
156-
"allow_force_pushes": false,
157-
"allow_deletions": false
158-
}')
159-
160-
HTTP_CODE=$(echo "$RESPONSE" | tail -n 1)
161-
BODY=$(echo "$RESPONSE" | sed '$d')
162-
163-
if [[ "$HTTP_CODE" -eq 200 ]] || [[ "$HTTP_CODE" -eq 201 ]]; then
164-
echo "✅ Branch protection successfully applied"
165-
else
166-
echo "⚠️ Failed to apply branch protection (HTTP $HTTP_CODE)"
167-
echo "Response: $BODY"
168-
# Don't fail the workflow, just warn
169-
fi
170131
171132
- name: Post summary
172133
if: steps.check_version.outputs.is_minor_bump == 'true'

0 commit comments

Comments
 (0)