|
34 | 34 | run: |
|
35 | 35 | echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > .npmrc
|
36 | 36 |
|
| 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 | +
|
37 | 56 | - name: Lerna Publish
|
38 | 57 | env:
|
39 | 58 | GIT_AUTHOR_NAME: ${{ env.BOT_NAME }}
|
|
42 | 61 | GIT_COMMITTER_EMAIL: ${{ env.BOT_EMAIL }}
|
43 | 62 | GH_TOKEN: ${{ secrets.DOCS_ENG_BOT_TOKEN }}
|
44 | 63 | 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