-
Notifications
You must be signed in to change notification settings - Fork 107
60 lines (54 loc) · 1.86 KB
/
build-metrics-report.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
---
name: Build Metrics Report
on: # yamllint disable-line rule:truthy
workflow_dispatch:
schedule:
- cron: "0 0 1 * *" # runs first day of every month at 12am UTC
env:
PY_VERSION: "3.10"
POETRY_VERSION: "1.7.1"
jobs:
fetch-report:
defaults:
run:
working-directory: metrics
runs-on: ubuntu-latest
name: Fetch Reports
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python ${{ env.PY_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PY_VERSION }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Setup a local virtual environment (if no poetry.toml file)
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v4
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Dependencies
run: |
poetry env use ${{ env.PY_VERSION }}
poetry install
- name: Retrieve the credentials and decode to a file
env:
GA_CREDENTIALS_JSON: ${{ secrets.GA_CREDENTIALS_JSON }}
run: |
echo $GA_CREDENTIALS_JSON | base64 --decode > datagov_metrics/credentials.json
- name: Run Python script
env:
AWS_ACCESS_KEY_ID_METRICS: ${{ secrets.AWS_ACCESS_KEY_ID_METRICS }}
AWS_SECRET_ACCESS_KEY_METRICS: ${{ secrets.AWS_SECRET_ACCESS_KEY_METRICS }}
AWS_DEFAULT_REGION: us-gov-west-1
run: |
poetry run python datagov_metrics