Skip to content

Commit

Permalink
chore: remove/add branch protection for release branches
Browse files Browse the repository at this point in the history
  • Loading branch information
LizBaker committed Feb 3, 2022
1 parent 8cd5c1f commit bcbb258
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions .github/workflows/update-whats-new-ids.yml
Expand Up @@ -40,11 +40,50 @@ jobs:
git add ./src/data/whats-new-ids.json
git diff-index --quiet HEAD ./src/data/whats-new-ids.json || git commit -m 'chore(whats-new-ids): updated ids'
echo "::set-output name=commit::true"
# Push directly to the release branch so we get the changes included in the release PR
- name: Temporarily disable branch protection
id: disable-branch-protection
uses: actions/github-script@v1
with:
github-token: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
previews: luke-cage-preview
script: |
const result = await github.repos.updateBranchProtection({
owner: context.repo.owner,
repo: context.repo.repo,
branch: context.payload.pull_request.head.ref,
required_status_checks: null,
restrictions: null,
enforce_admins: null,
required_pull_request_reviews: null
})
console.log("Result:", result)
# Push directly to the current release branch so we get the changes included in the release PR

- name: Push Commit
if: steps.commit-changes.outputs.commit == 'true'
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
branch: ${{ github.event.pull_request.head.ref }}
branch: ${{ github.head_ref }}

- name: Re-enable branch protection
id: enable-branch-protection
if: always()
uses: actions/github-script@v1
with:
github-token: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
previews: luke-cage-preview
script: |
const result = await github.repos.updateBranchProtection({
owner: context.repo.owner,
repo: context.repo.repo,
branch: context.payload.pull_request.head.ref,
enforce_admins: true,
required_status_checks: null,
restrictions: null,
required_pull_request_reviews: {
dismiss_stale_reviews: true,
required_approving_review_count: 1
}
})
console.log("Result:", result)

0 comments on commit bcbb258

Please sign in to comment.