-
Notifications
You must be signed in to change notification settings - Fork 66
106 lines (86 loc) · 3.47 KB
/
pull_request_for_xcm.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Check pull requests
on:
pull_request:
paths:
- 'xcm/**'
pull_request_target:
types: [labeled]
env:
BODY_FILE: body_file.txt
permissions:
pull-requests: write
jobs:
create-comment-with-changes:
runs-on: ubuntu-latest
name: Create a comment with xcm changed data
steps:
- name: Checkout
uses: actions/checkout@v3
- name: 🛠 Set up actual paths
uses: ./.github/workflows/setup-path
- name: Was transfers.json changed?
id: prod
uses: tj-actions/changed-files@v18.2
with:
files: |
${{ env.XCM_JSON_PATH }}
- name: Was transfers_dev.json changed?
id: dev
uses: tj-actions/changed-files@v18.2
with:
files: |
${{ env.DEV_XCM_JSON_PATH }}
- name: Was previous transfers.json changed?
id: prev_prod
uses: tj-actions/changed-files@v18.2
with:
files: |
${{ env.PREVIOUS_XCM_JSON_PATH }}
- name: Was previous transfers.json changed?
id: prev_dev
uses: tj-actions/changed-files@v18.2
with:
files: |
${{ env.PREVIOUS_DEV_XCM_JSON_PATH }}
- name: Set GITHUB_BASE environment variable
run: echo "GITHUB_BASE=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
- name: Install dependencies
run: make init
- name: Build body text
run: echo This comment was written by a bot! >> ${{ env.BODY_FILE }}
- name: Generate message for PROD
if: steps.prod.outputs.any_changed == 'true'
run: |
make pr-comment-creation PR_ENV=${{ env.XCM_VERSION }}-PROD PR_FILE_NAME=${{ env.BODY_FILE }} XCM_PATH=${{ env.XCM_JSON_PATH }} CHAINS_PATH=${{ env.CHAINS_JSON_PATH }}
- name: Generate message for DEV
if: steps.dev.outputs.any_changed == 'true'
run: |
make pr-comment-creation PR_ENV=${{ env.XCM_VERSION }}-DEV PR_FILE_NAME=${{ env.BODY_FILE }} XCM_PATH=${{ env.DEV_XCM_JSON_PATH }} CHAINS_PATH=${{ env.DEV_CHAINS_JSON_PATH }}
- name: Generate message for prvious PROD
if: steps.prev_prod.outputs.any_changed == 'true'
run: |
make pr-comment-creation PR_ENV=${{ env.PREVIOUS_XCM_VERSION }}-PROD PR_FILE_NAME=${{ env.BODY_FILE }} XCM_PATH=${{ env.PREVIOUS_XCM_JSON_PATH }} CHAINS_PATH=${{ env.PREVIOUS_CHAINS_JSON_PATH }}
- name: Generate message for prvious DEV
if: steps.prev_dev.outputs.any_changed == 'true'
run: |
make pr-comment-creation PR_ENV=${{ env.PREVIOUS_XCM_VERSION }}-DEV PR_FILE_NAME=${{ env.BODY_FILE }} XCM_PATH=${{ env.PREVIOUS_DEV_XCM_JSON_PATH }} CHAINS_PATH=${{ env.PREVIOUS_DEV_CHAINS_JSON_PATH }}
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: This comment was written by a bot!
- name: Create comment
if: steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
body-file: ${{ env.BODY_FILE }}
- name: Update comment
if: steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body-file: ${{ env.BODY_FILE }}
edit-mode: replace