Check for resume updates #48551
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: Check for resume updates | |
on: | |
workflow_dispatch: | |
workflow_call: | |
schedule: | |
- cron: '*/5 * * * *' # Run at every 5th minute | |
jobs: | |
pull_resume: | |
runs-on: ubuntu-latest | |
steps: | |
- if: github.event_name == 'workflow_call' | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
- if: github.event_name != 'workflow_call' | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.PAT }} | |
ref: ${{ github.ref }} | |
- name: Retrieve resume JSON file | |
run: curl -X GET ${{ secrets.RESUME_JSON_URL }} > fetched_resume.json | |
- name: Compare existing and fetched resumes | |
run: | | |
original=$(cat resume.json | jq -c '.') | |
fetched=$(cat fetched_resume.json | jq -c '.') | |
if [ "$original" = "$fetched" ]; then | |
echo "files-match=true" >> $GITHUB_ENV | |
else | |
echo "files-match=false" >> $GITHUB_ENV | |
fi | |
- name: Replace resume.json with fetched_resume.json | |
if: ${{ env.files-match == 'false' }} | |
run: | | |
mv fetched_resume.json resume.json | |
- name: Commit changes | |
if: ${{ env.files-match == 'false' }} | |
uses: stefanzweifel/[email protected] | |
with: | |
commit_message: Update resume.json | |
commit_options: '--no-verify' | |
file_pattern: resume.json | |
push: true |