-
Notifications
You must be signed in to change notification settings - Fork 8
62 lines (51 loc) · 1.66 KB
/
update-cv.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
59
60
61
62
# workflow that will udpate the CV file in cmor tables repository
name: update controlled vocabulary
on:
workflow_dispatch:
push:
paths:
- 'CORDEX-CMIP6_*.json'
- 'scripts/*.py'
branches:
- main
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
update_cv:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: checkout cordex-cv
uses: actions/checkout@v4
- name: checkout cordex cmor tables
uses: actions/checkout@v4
with:
repository: WCRP-CORDEX/cordex-cmip6-cmor-tables
path: tables
token: ${{ secrets.TABLE_ACCESS_TOKEN }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r scripts/requirements.txt
pip install pre-commit
- name: Update controlled vocabulary
run: |
cd scripts
pip install -e . --no-deps; cd ..
create-cv
mv CORDEX-CMIP6_CV.json tables/Tables
- name: Check if there are any changes
id: verify_diff
run: |
cd tables
git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit and push
if: steps.verify_diff.outputs.changed == 'true'
run: |
cd tables
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
(pre-commit run --all-files) || true
git commit Tables/CORDEX-CMIP6_CV.json -m "CV update"
git status
git push