-
Notifications
You must be signed in to change notification settings - Fork 3
58 lines (52 loc) · 1.96 KB
/
backup.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
name: Backup dashboards from grafana
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 3/6 * * *'
workflow_dispatch: {} # manual build
# example query
# curl -H "Authorization: Bearer eyJrIjoidWUzaDNYQ01NVGxzcUNNOWYwaTE1YVZxcGxHbFduQUIiLCJuIjoiZGFzaGJvYXJkc19iYWNrdXAiLCJpZCI6MX0=" https://eu-metrics-monitoring.livepeer.live/grafana/api/dashboards/home
jobs:
backup:
name: Run backup script for ${{ matrix.grafana.env }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
grafana:
- env: prod
url: https://eu-metrics-monitoring.livepeer.live/grafana
secret: GRAFANA_PROD_READ_API_KEY
- env: staging
url: https://eu-metrics-monitoring.livepeer.monster/grafana
secret: GRAFANA_STAGING_READ_API_KEY
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: master
- name: Run script to update dashboards
env:
API_KEY: ${{ secrets[matrix.grafana.secret] }}
run: |
./export.sh "${{ matrix.grafana.url }}" "${{ matrix.grafana.env }}"
- name: Commit and push changes
id: branch-commit
uses: devops-infra/[email protected]
with:
github_token: ${{ secrets.PUSH_TOKEN }}
target_branch: backup/grafana-${{ matrix.grafana.env }}
commit_prefix: "[AUTO-COMMIT] "
commit_message: 'Backup grafana dashboards'
force: true
- name: Create pull request with new dashboards
uses: devops-infra/[email protected]
with:
github_token: ${{ secrets.PUSH_TOKEN }}
source_branch: ${{ steps.branch-commit.outputs.branch_name }}
target_branch: master
title: '[AUTO] Dashboards backup (${{ matrix.grafana.env }})'
label: grafana
get_diff: true
allow_no_diff: false