fix: get HEAD id from git #12
This file contains 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: Resume Builder | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "example.py" | |
- ".github/workflows/resume.yml" | |
- "src/resume/utils.py" | |
- "src/template/*.*" | |
jobs: | |
generate-resume: | |
name: Generate Resume | |
if: github.repository == 'cybardev/resume' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: pandoc wkhtmltopdf poppler-utils | |
version: 1.0 | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Run resume generation script | |
run: | | |
python3 example.py | |
- name: Check for resume changes | |
id: check_updates | |
run: | | |
SHA_ID=$(git rev-parse --verify HEAD) | |
FILE_CHANGED=$(git diff-tree --no-commit-id --name-only -r ${SHA_ID} ./assets/Resume_*.md) | |
echo "changed=${FILE_CHANGED}" >> "${GITHUB_OUTPUT}" | |
echo "${FILE_CHANGED}" | |
- name: Commit changes | |
if: endsWith(steps.check_updates.outputs.changed, '.md') | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git commit -a -m "pipeline: update resume" | |
- name: Upload resume files | |
if: endsWith(steps.check_updates.outputs.changed, '.md') | |
uses: ad-m/github-push-action@master | |
with: | |
branch: main | |
github_token: ${{ secrets.GITHUB_TOKEN }} |