Skip to content

Commit ac4d33c

Browse files
authored
Merge pull request #1118 from newrelic/liz/update-branch-protection
Disable branch protection for publish
2 parents 6adbc7c + b5379e0 commit ac4d33c

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,25 @@ jobs:
3434
run: |
3535
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > .npmrc
3636
37+
- name: Temporarily disable "required_pull_request_reviews" branch protection
38+
id: disable-branch-protection
39+
if: always()
40+
uses: actions/github-script@v6
41+
with:
42+
github-token: ${{ secrets.DOCS_ENG_BOT_TOKEN }}
43+
previews: luke-cage-preview
44+
script: |
45+
const result = await github.rest.repos.updateBranchProtection({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
branch: 'main',
49+
required_status_checks: null,
50+
restrictions: null,
51+
enforce_admins: null,
52+
required_pull_request_reviews: null
53+
})
54+
console.log("Result:", result)
55+
3756
- name: Lerna Publish
3857
env:
3958
GIT_AUTHOR_NAME: ${{ env.BOT_NAME }}
@@ -42,3 +61,24 @@ jobs:
4261
GIT_COMMITTER_EMAIL: ${{ env.BOT_EMAIL }}
4362
GH_TOKEN: ${{ secrets.DOCS_ENG_BOT_TOKEN }}
4463
run: yarn release
64+
65+
- name: Re-enable "required_pull_request_reviews" branch protection
66+
id: enable-branch-protection
67+
if: always()
68+
uses: actions/github-script@v6
69+
with:
70+
github-token: ${{ secrets.DOCS_ENG_BOT_TOKEN }}
71+
previews: luke-cage-preview
72+
script: |
73+
const result = await github.rest.repos.updateBranchProtection({
74+
owner: context.repo.owner,
75+
repo: context.repo.repo,
76+
branch: 'main',
77+
required_status_checks: null,
78+
restrictions: null,
79+
enforce_admins: true,
80+
required_pull_request_reviews: {
81+
required_approving_review_count: 0
82+
}
83+
})
84+
console.log("Result:", result)

0 commit comments

Comments
 (0)