fix permissions error in build flow #5
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: Build Resume PDF | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Pandoc | |
| uses: r-lib/actions/setup-pandoc@v2 | |
| - name: Install LaTeX | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y texlive-latex-base texlive-fonts-recommended texlive-latex-extra | |
| - name: Convert Markdown to PDF | |
| run: | | |
| pandoc resume.md -o resume.pdf \ | |
| --pdf-engine=pdflatex \ | |
| --variable geometry:margin=1in \ | |
| --variable fontsize=11pt \ | |
| --variable linestretch=1.15 | |
| - name: Upload PDF artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: resume-pdf | |
| path: resume.pdf | |
| - name: Commit PDF back to repo (optional) | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add resume.pdf | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Auto-update resume PDF" | |
| git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:main | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |