27
27
github-token : ${{ secrets.NEWRELIC_BOT_TOKEN }} # must have push access to repos for stats queries to work
28
28
project-stats : true
29
29
30
+ - name : Temporarily disable branch protection
31
+ id : disable-branch-protection
32
+ uses : actions/github-script@v1
33
+ with :
34
+ github-token : ${{ secrets.OPENSOURCE_BOT_TOKEN }}
35
+ previews : luke-cage-preview
36
+ script : |
37
+ const result = await github.repos.updateBranchProtection({
38
+ owner: context.repo.owner,
39
+ repo: context.repo.repo,
40
+ branch: 'develop',
41
+ required_status_checks: null,
42
+ restrictions: null,
43
+ enforce_admins: null,
44
+ required_pull_request_reviews: null
45
+ })
46
+ console.log("Result:", result)
47
+
30
48
- name : Commit data files
31
49
run : |
32
50
git config --local user.email "${{ env.THIRD_PARTY_GIT_AUTHOR_EMAIL }}"
@@ -49,11 +67,33 @@ jobs:
49
67
git cherry-pick $CHERRYCOMMIT
50
68
git push origin main
51
69
52
- # - name: Push Commit
53
-
54
- # with:
55
- # github_token: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
56
- # branch: ${{ github.ref }} #pushes to the branch that kicked off the job
70
+ - name : Re-enable branch protection
71
+ id : enable-branch-protection
72
+ if : always()
73
+ uses : actions/github-script@v1
74
+ with :
75
+ github-token : ${{ secrets.OPENSOURCE_BOT_TOKEN }}
76
+ previews : luke-cage-preview
77
+ script : |
78
+ const result = await github.repos.updateBranchProtection({
79
+ owner: context.repo.owner,
80
+ repo: context.repo.repo,
81
+ branch: 'develop',
82
+ required_status_checks: {
83
+ strict: false,
84
+ contexts: ['Gatsby Build']
85
+ },
86
+ restrictions: {
87
+ users: [],
88
+ teams: []
89
+ },
90
+ enforce_admins: true,
91
+ required_pull_request_reviews: {
92
+ dismiss_stale_reviews: true,
93
+ required_approving_review_count: 1
94
+ }
95
+ })
96
+ console.log("Result:", result)
57
97
58
98
job-checkout-and-build :
59
99
runs-on : ubuntu-latest
0 commit comments