-
Notifications
You must be signed in to change notification settings - Fork 55
58 lines (47 loc) · 1.62 KB
/
arborescence-monitoring.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
name: Arborescence monitoring
on:
schedule:
- cron: '0 7 * * 1-5'
defaults:
run:
shell: bash
working-directory: api
env:
GIST_ID: 62aad2c4b2fbfddd519dc86413e14b7b
GIST_RAW_URL: 'https://gist.githubusercontent.com/pix-service/62aad2c4b2fbfddd519dc86413e14b7b/raw/tech_days_api_arbo.json'
jobs:
monitoring:
name: Publish metrics
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: npm
- name: Download metrics Gist
run: |
curl "${GIST_RAW_URL}" > tech_days_api_arbo.json
- name: Update local file arborescence metrics
run: |
npm run monitoring:metrics -- tech_days_api_arbo.json
- name: Update metrics Gist
uses: exuanbo/actions-deploy-gist@v1
with:
token: '${{ secrets.DASHBOARD_API_ARBORESCENCE_GIST_TOKEN }}'
gist_id: '${{ env.GIST_ID }}'
file_path: api/tech_days_api_arbo.json
- name: Create monitoring charts
id: monitoring
env:
BRANCH_NAME: '${{ github.ref_name }}'
run: |
MONITORING=$(npm run monitoring:arborescence --silent -- tech_days_api_arbo.json)
echo "${MONITORING}" >> ${GITHUB_STEP_SUMMARY}
echo "MONITORING_RESULT=${MONITORING}" >> ${GITHUB_ENV}
- name: Notify Slack
id: notify
env:
WEBHOOK_URL: '${{ secrets.DASHBOARD_API_ARBORESCENCE_SLACK_WEBHOOK_URL }}'
run: |
curl -X POST "${WEBHOOK_URL}" -H 'Content-Type: application/json' -d "${MONITORING_RESULT}"