forked from atomfinger/resume
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (42 loc) · 1.39 KB
/
pull_resume.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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