Add pieces for update-cmor-cvs-table slash command #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.pull_request.head.repo.owner.login }} | |
| CMIP7_CVS_BRANCH: ${{ github.head_ref || github.ref_name }} | |
| 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: Reset environment file | |
| run: | | |
| # Reset environment file (we don't need/want to keep these changes) | |
| git checkout -- cmor-cvs-creation.env | |
| - 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 and/or related files are 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) |