Monthly CV Update #24
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: Monthly CV Update | |
| on: | |
| schedule: | |
| - cron: '0 0 1 * *' # Runs at 00:00 on the first day of every month | |
| workflow_dispatch: # Allows manual triggering to prevent auto-disable | |
| # Prevent concurrent runs that could cause conflicts | |
| concurrency: | |
| group: cv-update | |
| cancel-in-progress: false | |
| jobs: | |
| update-cv: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 # Prevent hanging jobs | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| - name: Set up R | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| use-public-rspm: true | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev | |
| - name: Setup R dependencies | |
| uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| packages: | | |
| any::rorcid | |
| any::rcrossref | |
| any::RefManageR | |
| any::dplyr | |
| any::stringr | |
| any::jsonlite | |
| - name: Check ORCID token | |
| run: | | |
| if [ -z "${{ secrets.ORCID_TOKEN }}" ]; then | |
| echo "::error::ORCID_TOKEN secret is not set. Please add it to repository secrets." | |
| exit 1 | |
| fi | |
| - name: Refresh publications | |
| run: Rscript update_pubs.R | |
| env: | |
| ORCID_TOKEN: ${{ secrets.ORCID_TOKEN }} | |
| - name: Set up Typst | |
| uses: typst-community/setup-typst@v5 | |
| - name: Install Font Awesome | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y fonts-font-awesome | |
| sudo fc-cache -fv | |
| - name: Compile CV (Typst) | |
| run: typst compile vita/sy-vita.typ | |
| - name: Commit updated CV | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| if git diff --quiet -- vita/sy-vita.pdf vita/sy-vita.typ research/index.qmd 2>/dev/null \ | |
| && ! git ls-files --others --exclude-standard -- vita/sy-vita.pdf | grep -q .; then | |
| echo "No changes to CV, skipping commit" | |
| exit 0 | |
| fi | |
| git add vita/sy-vita.typ vita/sy-vita.pdf research/index.qmd | |
| git commit -m "Automated CV update" | |
| for i in {1..3}; do | |
| if git push origin HEAD:main; then | |
| echo "Push successful on attempt $i" | |
| break | |
| elif [ $i -lt 3 ]; then | |
| echo "Push failed on attempt $i, retrying..." | |
| git pull --rebase origin main | |
| sleep 5 | |
| else | |
| echo "Push failed after 3 attempts." | |
| exit 1 | |
| fi | |
| done | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |