|
6 | 6 | with:
|
7 | 7 | fetch-depth: 0
|
8 | 8 | - uses: ./.github/actions/prepare
|
9 |
| - - uses: JoshuaKGoldberg/[email protected] |
| 9 | + - uses: JoshuaKGoldberg/[email protected] |
| 10 | + - name: Delete branch protection on main |
| 11 | + |
| 12 | + with: |
| 13 | + github-token: ${{ secrets.ACCESS_TOKEN }} |
| 14 | + script: | |
| 15 | + try { |
| 16 | + await github.request( |
| 17 | + `DELETE /repos/JoshuaKGoldberg/template-typescript-node-package/branches/main/protection`, |
| 18 | + ); |
| 19 | + } catch (error) { |
| 20 | + if (!error.message?.includes?.("Branch not protected")) { |
| 21 | + throw error; |
| 22 | + } |
| 23 | + } |
10 | 24 | - uses: stefanzweifel/git-auto-commit-action@v4
|
11 | 25 | with:
|
12 | 26 | commit_message: "Fill in all-contributors"
|
| 27 | + - if: always() |
| 28 | + name: Recreate branch protection on main |
| 29 | + |
| 30 | + with: |
| 31 | + github-token: ${{ secrets.ACCESS_TOKEN }} |
| 32 | + # Note: keep this inline script in sync with script/setup.js! |
| 33 | + # Todo: it would be nice to not have two sources of truth... |
| 34 | + # https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues/145 |
| 35 | + script: | |
| 36 | + github.request( |
| 37 | + `PUT /repos/JoshuaKGoldberg/template-typescript-node-package/branches/main/protection`, |
| 38 | + { |
| 39 | + allow_deletions: false, |
| 40 | + allow_force_pushes: true, |
| 41 | + allow_fork_pushes: false, |
| 42 | + allow_fork_syncing: true, |
| 43 | + block_creations: false, |
| 44 | + branch: "main", |
| 45 | + enforce_admins: false, |
| 46 | + owner: "JoshuaKGoldberg", |
| 47 | + repo: "template-typescript-node-package", |
| 48 | + required_conversation_resolution: true, |
| 49 | + required_linear_history: false, |
| 50 | + required_pull_request_reviews: null, |
| 51 | + required_status_checks: { |
| 52 | + checks: [ |
| 53 | + { context: "build" }, |
| 54 | + { context: "compliance" }, |
| 55 | + { context: "knip" }, |
| 56 | + { context: "lint" }, |
| 57 | + { context: "markdown" }, |
| 58 | + { context: "package" }, |
| 59 | + { context: "packages" }, |
| 60 | + { context: "prettier" }, |
| 61 | + { context: "spelling" }, |
| 62 | + { context: "test" }, |
| 63 | + ], |
| 64 | + strict: false, |
| 65 | + }, |
| 66 | + restrictions: null, |
| 67 | + } |
| 68 | + ); |
13 | 69 |
|
14 | 70 | name: Contributors
|
15 | 71 |
|
|
0 commit comments