-
Notifications
You must be signed in to change notification settings - Fork 70
97 lines (85 loc) · 2.9 KB
/
update_xcm_data.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
name: Update xcm coefficients
on:
schedule:
- cron: '0 8 1/3 * *'
workflow_dispatch:
inputs:
environment:
required: true
description: Which file will be updated DEV or PROD
type: choice
default: PROD
options:
- DEV
- PROD
jobs:
update-xcm:
runs-on: ubuntu-latest
steps:
- name: Checkout current repository to Master branch
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set environment
run: |
if [ "${{ github.event.inputs.environment }}" = "PROD" ]; then
echo "ENVIRONMENT=PROD" >> "$GITHUB_ENV"
else
echo "ENVIRONMENT=DEV" >> "$GITHUB_ENV"
fi
- name: Checkout support repo
uses: actions/checkout@v2
with:
path: ./support
repository: nova-wallet/support-utils
ref: master
token: ${{ secrets.PAT_TOKEN }}
- name: 🛠 Set up actual paths
uses: ./.github/workflows/setup-path
- name: ⚙️ Install dependencies
run: |
cd ./support
make install
- name: 🦾 Generate new xcm coefficients
run: |
cd ./support
make update-xcm
- name: Move generated file
run: |
if [ "${{ github.event.inputs.environment }}" = "PROD" ]; then
mv support/transfers.json ${{ env.XCM_JSON_PATH }}
echo "COMMIT_FILE=${{ env.XCM_JSON_PATH }}" >> "$GITHUB_ENV"
echo "PR_REVIEWER=ERussel,leohar,valentunn,stepanLav" >> "$GITHUB_ENV"
else
mv support/transfers_dev.json ${{ env.DEV_XCM_JSON_PATH }}
echo "COMMIT_FILE=${{ env.DEV_XCM_JSON_PATH }}" >> "$GITHUB_ENV"
echo "PR_REVIEWER=leohar,stepanLav" >> "$GITHUB_ENV"
fi
- name: Make Pull Request
uses: ./.github/workflows/make-pull-request
with:
commit-files: ${{ env.COMMIT_FILE }}
commit-message: Update xcm coefficients
app-id: ${{ secrets.PR_APP_ID}}
app-token: ${{ secrets.PR_APP_TOKEN}}
pr-reviewer: ${{ env.PR_REVIEWER }}
branch-name: update-xcm-coefficients
pr-title: 🆙 Update XCM coefficients for ${{ env.ENVIRONMENT }} env
pr-body: This PR was generated automatically 🤖
pr-base: master
alert:
runs-on: ubuntu-latest
needs: update-xcm
if: always() && (needs.update-xcm.result == 'failure')
env:
GITHUB_WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
steps:
- name: Report
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
XCM update workflow failed, lets check:
Failed run:
${{ env.GITHUB_WORKFLOW_URL }}