@@ -2,8 +2,6 @@ name: Check unallowed file changes
22
33on :
44 push :
5- pull_request :
6- types : [opened, reopened]
75
86jobs :
97 triage :
2220 ...context.repo,
2321 commit_sha: context.sha
2422 })
25- const pullNumber = pulls.data
26- .map(pull => pull.number)
27- .shift()
2823
29- if (pullNumber) {
30- console.log(`Pull request number: ${pullNumber}`)
31- return pullNumber
32- } else {
33- console.log(`When this workflow ran, the associated pull request was not yet created. Pushing a new commit after you've created a pull request will automatically re-run this workflow, or you can manually re-run the workflow.`)
34- process.exit(1)
35- }
24+ return pulls.data.map(pull => pull.number).shift()
3625 - name : Check for existing requested changes
3726 id : requested-change
3827 uses : actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
@@ -45,16 +34,10 @@ jobs:
4534 pull_number: ${{steps.pull-number.outputs.result}}
4635 })
4736
48- const botReviews = pullReviews.data
37+ return pullReviews.data
4938 .filter(review => review.user.login === 'github-actions[bot]')
5039 .sort((a, b) => new Date(b.submitted_at) - new Date(a.submitted_at))
5140 .shift()
52-
53- if (botReviews) {
54- console.log(`Pull request reviews authored by the github-action bot: ${botReviews}`)
55- }
56- return botReviews
57-
5841 - name : Get files changed
5942 uses : dorny/paths-filter@eb75a1edc117d3756a18ef89958ee59f9500ba58
6043 id : filter
@@ -121,9 +104,7 @@ jobs:
121104 # When the most recent review was CHANGES_REQUESTED and the existing
122105 # PR no longer contains unallowed changes, dismiss the previous review
123106 - name : Dismiss pull request review
124- # Check that unallowed files aren't modified and that a
125- # CHANGES_REQUESTED review already exists
126- if : ${{ steps.filter.outputs.notAllowed == 'false' && steps.requested-change.outputs.result && fromJson(steps.requested-change.outputs.result).state == 'CHANGES_REQUESTED' }}
107+ if : ${{ steps.filter.outputs.notAllowed == 'false' && fromJson(steps.requested-change.outputs.result).state == 'CHANGES_REQUESTED' }}
127108 uses : actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
128109 with :
129110 github-token : ${{secrets.GITHUB_TOKEN}}
0 commit comments