Skip to content

Commit d018eb7

Browse files
authored
Merge pull request #2773 from microsoftgraph/fix/metadata-changes-permissions
Fix Metadata breaking change workflow
2 parents ae046fe + b317b3d commit d018eb7

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/workflows/metadatachanges.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,23 @@
33
# This is a basic workflow to help you get started with Actions
44

55
name: "Metadata Changes"
6-
# Controls when the action will run. Triggers the workflow on push or pull request
7-
# events but only for the master branch
86
on:
97
workflow_dispatch:
108
pull_request:
11-
types: [opened, synchronize, reopened, closed]
129
branches:
1310
- dev
11+
paths:
12+
- openApiDocs/**
13+
- src/Authentication/Authentication/custom/common/MgCommandMetadata.json
14+
- docs/OpenApiInfo/**
1415

1516
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1617
jobs:
1718
CheckForMetadataChanges:
1819
# The type of runner that the job will run on
1920
runs-on: ubuntu-latest
21+
permissions:
22+
pull-requests: write
2023
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.action != 'closed')
2124
# Steps represent a sequence of tasks that will be executed as part of the job
2225
steps:
@@ -50,6 +53,16 @@ jobs:
5053
body: body
5154
})
5255

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+
5366
# [0] https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
5467
# [1] https://hub.github.com/hub-pull-request.1.html
5568
# https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token

0 commit comments

Comments
 (0)