forked from Azure/terraform-azurerm-vnet
-
Notifications
You must be signed in to change notification settings - Fork 1
34 lines (32 loc) · 1.18 KB
/
breaking-change-detect.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: 'Comment on PR'
on:
workflow_run:
workflows: ["Pre Pull Request Check"]
types:
- completed
jobs:
comment:
name: 'breaking change detect'
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.event == 'pull_request' }}
steps:
- name: 'Download change artifact'
uses: dawidd6/action-download-artifact@v2
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
run_id: ${{ github.event.workflow_run.id }}
workflow: pr-check.yaml
name: change
if_no_artifact_found: ignore
- name: Check change existence
id: check_change
uses: andstor/file-existence-action@v1
with:
files: "change"
- name: 'Comment on PR'
if: steps.check_change.outputs.files_exists == 'true'
run: |
export PR_NUMBER=$(cat change | jq -r '.pr')
msg=$(cat change | jq -r '.body')
jq -n --arg msg "$msg" '{body: $msg}' > body.txt
curl -s -X POST -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments -d @body.txt