Skip to content

Arborescence monitoring #312

Arborescence monitoring

Arborescence monitoring #312

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}"