Merge branch 'main' into 101-generating-markdown-admonitions-based-on… #212
Workflow file for this run
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: Update Metadata | |
| on: | |
| push: | |
| workflow_dispatch: | |
| # Prevent infinite loops when workflow commits changes | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| update-metadata: | |
| runs-on: ubuntu-latest | |
| # Need write permission to push changes | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: pip | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyyaml | |
| - name: Update metadata files | |
| run: python -m quadriga.metadata.run_all | |
| - name: Check if files changed | |
| id: check_changes | |
| run: | | |
| if git diff --quiet metadata.yml && git diff --quiet CITATION.bib && git diff --quiet CITATION.cff; then | |
| echo "changes_detected=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes_detected=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit changes if necessary | |
| if: steps.check_changes.outputs.changes_detected == 'true' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add metadata.yml CITATION.bib | |
| git commit -m "[Automated] Update metadata files" | |
| git push |