Skip to content

Commit c8a911e

Browse files
authored
Merge pull request #1 from oddish3/copilot/review-github-folder-workflows
2 parents 3763217 + 4ab7815 commit c8a911e

File tree

3 files changed

+252
-24
lines changed

3 files changed

+252
-24
lines changed

.github/README.md

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
# GitHub Actions Workflows
2+
3+
This directory contains automated workflows for maintaining the website and CV.
4+
5+
## Workflows
6+
7+
### 1. Quarto Publish (`quarto-publish.yml`)
8+
9+
**Purpose**: Automatically builds and deploys the Quarto website to GitHub Pages.
10+
11+
**Triggers**:
12+
- Push to `main` branch
13+
- Manual trigger via workflow_dispatch
14+
15+
**What it does**:
16+
1. Sets up R environment and dependencies
17+
2. Installs Quarto
18+
3. Renders the website
19+
4. Publishes to gh-pages branch
20+
21+
**Best Practices Implemented**:
22+
- Concurrency control prevents simultaneous deployments
23+
- 20-minute timeout prevents hanging jobs
24+
- Can be manually triggered if needed
25+
26+
---
27+
28+
### 2. Monthly CV Update (`update-cv.yml`)
29+
30+
**Purpose**: Automatically updates CV with latest publications from ORCID.
31+
32+
**Triggers**:
33+
- Scheduled: 1st day of every month at midnight UTC
34+
- Manual trigger via workflow_dispatch (important - see below!)
35+
36+
**What it does**:
37+
1. Fetches latest publications from ORCID
38+
2. Updates `research/index.qmd` with publication list
39+
3. Updates `cv/resume.typ` with publications
40+
4. Compiles the CV to PDF using Typst
41+
5. Commits and pushes changes back to repository
42+
43+
**Best Practices Implemented**:
44+
- Concurrency control prevents overlapping update runs
45+
- 30-minute timeout prevents hanging jobs
46+
- Error handling for missing ORCID_TOKEN
47+
- Retry logic for git push operations
48+
- Uses `[skip ci]` to prevent trigger loops
49+
50+
**Requirements**:
51+
- `ORCID_TOKEN` must be set in repository secrets
52+
53+
---
54+
55+
## Important: GitHub's 60-Day Workflow Disable Policy
56+
57+
⚠️ **CRITICAL INFORMATION ABOUT SCHEDULED WORKFLOWS**
58+
59+
GitHub automatically **disables scheduled workflows** (like the Monthly CV Update) if:
60+
- There is **no repository activity for 60 days**
61+
- This includes no commits, no pull requests, no issues, etc.
62+
63+
### Why This Happens
64+
65+
When a repository is inactive for 60 days, GitHub assumes the project is dormant and disables all scheduled workflows to save resources. You'll receive an email notification when this occurs:
66+
67+
> "The 'Monthly CV Update' workflow in username/repository has been disabled"
68+
69+
### How to Prevent Auto-Disable
70+
71+
You have several options:
72+
73+
1. **Manual Trigger (Recommended)**:
74+
- Visit: Actions → Monthly CV Update → Run workflow
75+
- This counts as repository activity and resets the 60-day timer
76+
- Run this every ~50 days (just over 7 weeks) if you're not actively committing to provide a safety margin
77+
78+
2. **Make Regular Commits**:
79+
- Any commit to the repository resets the timer
80+
- The workflow itself commits changes when publications update
81+
82+
3. **Keep-Alive Workflow** (Not Implemented):
83+
- Could add a separate workflow that commits a timestamp file every 50 days
84+
- Decided against this to avoid polluting git history
85+
86+
### How to Re-Enable After Disable
87+
88+
If the workflow gets disabled:
89+
90+
1. Go to the **Actions** tab in your repository
91+
2. Click on "**Monthly CV Update**" in the left sidebar
92+
3. Click the "**Enable workflow**" button
93+
4. Optionally, click "**Run workflow**" to trigger it immediately
94+
95+
### Monitoring
96+
97+
- Check your email for GitHub notifications
98+
- Visit the Actions tab periodically to verify workflows are enabled
99+
- The workflow_dispatch trigger ensures you can always run it manually
100+
101+
---
102+
103+
## Secrets Required
104+
105+
The following secrets must be configured in repository settings:
106+
107+
1. **ORCID_TOKEN**: Required for the Monthly CV Update workflow
108+
- Used to authenticate with ORCID API
109+
- Get from: https://orcid.org/developer-tools
110+
- Add via: Settings → Secrets and variables → Actions → New repository secret
111+
112+
2. **GITHUB_TOKEN**: Automatically provided by GitHub
113+
- Used for pushing commits and deploying pages
114+
- No configuration needed
115+
116+
---
117+
118+
## Manual Workflow Execution
119+
120+
Both workflows can be manually triggered:
121+
122+
1. Go to the **Actions** tab
123+
2. Select the workflow you want to run
124+
3. Click "**Run workflow**"
125+
4. Select the branch (usually `main`)
126+
5. Click "**Run workflow**" button
127+
128+
This is useful for:
129+
- Testing changes to workflows
130+
- Forcing an update outside the schedule
131+
- Re-running after fixing an error
132+
- Resetting the 60-day inactivity timer
133+
134+
---
135+
136+
## Troubleshooting
137+
138+
### Workflow Fails with "ORCID_TOKEN secret is not set"
139+
140+
**Solution**: Add the ORCID_TOKEN secret:
141+
1. Go to Settings → Secrets and variables → Actions
142+
2. Click "New repository secret"
143+
3. Name: `ORCID_TOKEN`
144+
4. Value: Your ORCID API token
145+
5. Click "Add secret"
146+
147+
### Workflow is Disabled
148+
149+
**Cause**: No repository activity for 60 days
150+
151+
**Solution**: See "How to Re-Enable After Disable" section above
152+
153+
### Git Push Fails in CV Update
154+
155+
**Cause**: Concurrent workflow runs or external commits
156+
157+
**Solution**: The workflow includes retry logic. If it persists:
158+
1. Check for concurrent workflow runs
159+
2. Manually pull latest changes
160+
3. Re-run the workflow
161+
162+
### Publications Not Updating
163+
164+
**Possible causes**:
165+
1. ORCID profile not updated
166+
2. DOIs not in ORCID record
167+
3. Crossref API issues
168+
169+
**Debug**:
170+
1. Check workflow logs in Actions tab
171+
2. Verify publications are in your ORCID profile
172+
3. Ensure DOIs are correct format
173+
174+
---
175+
176+
## Maintenance
177+
178+
### Updating Dependencies
179+
180+
When updating action versions in workflows:
181+
182+
1. Check the action's repository for breaking changes
183+
2. Test in a separate branch first
184+
3. Update version numbers gradually (don't skip major versions)
185+
186+
### Modifying the Schedule
187+
188+
To change the CV update frequency, edit the cron expression in `update-cv.yml`:
189+
190+
```yaml
191+
schedule:
192+
- cron: '0 0 1 * *' # Current: Monthly on the 1st
193+
# Examples:
194+
# - cron: '0 0 * * 0' # Weekly on Sunday
195+
# - cron: '0 0 1 */3 *' # Quarterly (every 3 months)
196+
```
197+
198+
**Note**: More frequent schedules use more GitHub Actions minutes but help prevent the 60-day disable.
199+
200+
---
201+
202+
## Additional Notes
203+
204+
- All workflows use Ubuntu latest runners
205+
- R version is set to 'release' for stability
206+
- Quarto uses the latest version from quarto-dev
207+
- Typst is installed via the official setup action
208+
- Font Awesome is required for CV compilation

.github/workflows/quarto-publish.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@ on:
66
- main
77
workflow_dispatch:
88

9+
# Prevent concurrent deployments
10+
concurrency:
11+
group: pages-deploy
12+
cancel-in-progress: false
13+
914
jobs:
1015
deploy-website:
1116
runs-on: ubuntu-latest
17+
timeout-minutes: 20 # Prevent hanging jobs
1218
permissions:
1319
contents: write
1420
pages: write

.github/workflows/update-cv.yml

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
name: Monthly CV Update
22
on:
33
schedule:
4-
- cron: '0 0 1 * *'
5-
workflow_dispatch:
4+
- cron: '0 0 1 * *' # Runs at 00:00 on the first day of every month
5+
workflow_dispatch: # Allows manual triggering to prevent auto-disable
6+
7+
# Prevent concurrent runs that could cause conflicts
8+
concurrency:
9+
group: cv-update
10+
cancel-in-progress: false
11+
612
jobs:
713
update-cv:
814
runs-on: ubuntu-latest
15+
timeout-minutes: 30 # Prevent hanging jobs
916
permissions:
1017
contents: write
1118
steps:
@@ -36,6 +43,13 @@ jobs:
3643
any::stringr
3744
any::jsonlite
3845
46+
- name: Check ORCID token
47+
run: |
48+
if [ -z "${{ secrets.ORCID_TOKEN }}" ]; then
49+
echo "::error::ORCID_TOKEN secret is not set. Please add it to repository secrets."
50+
exit 1
51+
fi
52+
3953
- name: Refresh publications
4054
run: Rscript update_pubs.R
4155
env:
@@ -55,27 +69,27 @@ jobs:
5569

5670
- name: Commit updated CV
5771
run: |
58-
git config --global user.name "github-actions[bot]"
59-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
60-
if git diff --quiet -- cv/resume.pdf cv/resume.typ research/index.qmd 2>/dev/null; then
61-
echo "No changes to CV, skipping commit"
62-
exit 0
63-
fi
64-
git pull --rebase origin main
65-
git add cv/resume.pdf cv/resume.typ research/index.qmd
66-
git commit -m "Automated CV update [skip ci]"
67-
for i in {1..3}; do
68-
if git push origin HEAD:main; then
69-
echo "Push successful on attempt $i"
70-
break
71-
elif [ $i -lt 3 ]; then
72-
echo "Push failed on attempt $i, retrying..."
73-
git pull --rebase origin main
74-
sleep 5
75-
else
76-
echo "Push failed after 3 attempts."
77-
exit 1
78-
fi
79-
done
72+
git config --global user.name "github-actions[bot]"
73+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
74+
if git diff --quiet -- cv/resume.pdf cv/resume.typ research/index.qmd 2>/dev/null; then
75+
echo "No changes to CV, skipping commit"
76+
exit 0
77+
fi
78+
git pull --rebase origin main
79+
git add cv/resume.pdf cv/resume.typ research/index.qmd
80+
git commit -m "Automated CV update [skip ci]"
81+
for i in {1..3}; do
82+
if git push origin HEAD:main; then
83+
echo "Push successful on attempt $i"
84+
break
85+
elif [ $i -lt 3 ]; then
86+
echo "Push failed on attempt $i, retrying..."
87+
git pull --rebase origin main
88+
sleep 5
89+
else
90+
echo "Push failed after 3 attempts."
91+
exit 1
92+
fi
93+
done
8094
env:
8195
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)