-
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (86 loc) · 2.96 KB
/
save_daily_metrics.yml
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
name: save-daily-metrics
on:
workflow_dispatch:
schedule:
# Run every day at 8:00 PM UTC
# https://crontab.guru/#0_20_*_*_*
- cron: "0 20 * * *"
jobs:
save-daily-metrics:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up conda environment for testing
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
cache-environment: true
condarc: |
channels:
- conda-forge
channel_priority: strict
- name: Log conda environnment information
run: |
conda info
conda list
conda config --show-sources
conda config --show
printenv | sort
- name: Authenticate gcloud
id: gcloud-auth
continue-on-error: true
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GCP_USAGE_METRICS_ARCHIVER_KEY }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v2"
with:
version: ">= 363.0.0"
- shell: bash -l {0}
name: Save Github Metrics
id: github
env:
API_TOKEN_GITHUB: ${{ secrets.USAGE_STATS_ACCESS_TOKEN }}
run: |
python src/usage_metrics/scripts/save_github_metrics.py
- shell: bash -l {0}
name: Save Kaggle Metrics
id: kaggle
# Run even if prior metric saving fails
if: "!cancelled()"
env:
KAGGLE_KEY: ${{ secrets.KAGGLE_KEY }}
KAGGLE_USERNAME: ${{ secrets.KAGGLE_USERNAME }}
run: |
python src/usage_metrics/scripts/save_kaggle_metrics.py
- shell: bash -l {0}
name: Save Zenodo Metrics
id: zenodo
# Run even if prior metric saving fails
if: "!cancelled()"
run: |
python src/usage_metrics/scripts/save_zenodo_metrics.py
- name: Inform the Codemonkeys
uses: 8398a7/action-slack@v3
with:
status: custom
fields: workflow,job,commit,repo,ref,author,took
custom_payload: |
{
username: 'action-slack',
icon_emoji: ':octocat:',
attachments: [{
color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning',
text: `${process.env.AS_WORKFLOW}\n${process.env.AS_JOB} (${process.env.AS_COMMIT}) of ${process.env.AS_REPO}@${process.env.AS_REF} by ${process.env.AS_AUTHOR} ${{ job.status }} in ${process.env.AS_TOOK}`,
}]
}
env:
GITHUB_TOKEN: ${{ github.token }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
MATRIX_CONTEXT: ${{ toJson(matrix) }} # required
if: always() # Pick up events even if the job fails or is canceled.