Skip to content

Add pieces for update-cmor-cvs-table slash command #2

Add pieces for update-cmor-cvs-table slash command

Add pieces for update-cmor-cvs-table slash command #2

name: Check CMOR CVs table
on:
pull_request:
push:
branches: [main]
tags: ['v*']
jobs:
check-cmor-cvs-table-is-up-to-date:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Update environment file
env:
CMIP7_CVS_FORK: ${{ github.event.inputs.cmip7-cvs-fork }}
CMIP7_CVS_BRANCH: ${{ github.event.inputs.cmip7-cvs-branch }}
run: |
# Update the CMIP7 CVs fork and branch in the environment file
sed -i -e 's/CMIP7_CVS_FORK=.*/CMIP7_CVS_FORK='"${CMIP7_CVS_FORK}"'/g' cmor-cvs-creation.env
sed -i -e 's/CMIP7_CVS_BRANCH=.*/CMIP7_CVS_BRANCH='"${CMIP7_CVS_BRANCH}"'/g' cmor-cvs-creation.env
- name: Set up environment
run: |
source cmor-cvs-creation.env
bash install-environment-for-cmor-cvs-creation.sh -v
- name: Check CMOR CVs table is up to date
run: |
esgvoc cmor-export-cvs-table --out-path cmor-cvs.json
git diff
(! git status --porcelain --untracked-files=no | grep '^.M') || (echo 'CMOR CVs table is not up to date. Please comment `/update-cmor-cvs-table` in your pull request or update the CMOR CVs file locally and commit the result. If you need help, please feel free to tag `@znichollscr` in your pull request.' && exit 1)