Update from TreeTools #77
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 from TreeTools | |
| on: | |
| schedule: | |
| - cron: '0 1 * * 1' # Runs weekly on Monday at 01:00 UTC | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '.github/workflows/update-csl.yml' | |
| jobs: | |
| update-csl: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Download latest CSL file | |
| run: | | |
| curl -L -f -o inst/apa-old-doi-prefix.csl https://raw.githubusercontent.com/ms609/TreeTools/main/inst/apa-old-doi-prefix.csl | |
| - name: Validate download | |
| run: | | |
| python3 -c "import xml.etree.ElementTree as ET; ET.parse('inst/apa-old-doi-prefix.csl')" || { echo "Invalid XML detected"; exit 1; } | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if git diff --quiet inst/apa-old-doi-prefix.csl; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| echo "No changes to commit" | |
| else | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| echo "Changes detected" | |
| fi | |
| - name: Commit and push | |
| if: steps.changes.outputs.changed == 'true' | |
| run: | | |
| git config --local user.email "actions@github.com" | |
| git config --local user.name "GitHub Actions" | |
| git add inst/apa-old-doi-prefix.csl | |
| git commit -m "Update CSL file from upstream" | |
| git push |