Skip to content

Commit b317b3d

Browse files
committed
Grant workflow pull request write permissions and fail job to block merges
1 parent 2138ec9 commit b317b3d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/metadatachanges.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
CheckForMetadataChanges:
1919
# The type of runner that the job will run on
2020
runs-on: ubuntu-latest
21+
permissions:
22+
pull-requests: write
2123
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.action != 'closed')
2224
# Steps represent a sequence of tasks that will be executed as part of the job
2325
steps:
@@ -51,6 +53,16 @@ jobs:
5153
body: body
5254
})
5355

56+
await github.rest.pulls.createReview({
57+
owner: context.repo.owner,
58+
repo: context.repo.repo,
59+
body: body,
60+
pull_number: context.issue.number,
61+
event: 'REQUEST_CHANGES'
62+
})
63+
64+
core.setFailed(body)
65+
5466
# [0] https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
5567
# [1] https://hub.github.com/hub-pull-request.1.html
5668
# https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token

0 commit comments

Comments
 (0)