Skip to content

Commit 9bb044e

Browse files
committed
fix: switch submodule to HTTPS + add PAT support for private repo access
- .gitmodules: git@github.com → https://github.com (SSH fails on runners) - Workflow: use INTRO_LECTURE_PAT secret for private repo, fallback GITHUB_TOKEN - git url rewrite covers both SSH and HTTPS origins - Node.js 24 env already set
1 parent c600224 commit 9bb044e

2 files changed

Lines changed: 18 additions & 15 deletions

File tree

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
name: Sync intro-lecture submodule
22

33
on:
4-
# Manual trigger
54
workflow_dispatch:
6-
# Daily at 06:00 UTC
75
schedule:
86
- cron: '0 6 * * *'
9-
# Also trigger when dhbern.github.io itself is pushed
107
push:
118
branches: [main]
129

@@ -18,34 +15,40 @@ jobs:
1815
runs-on: ubuntu-latest
1916
permissions:
2017
contents: write
18+
2119
steps:
2220
- name: Checkout with submodules
2321
uses: actions/checkout@v5
2422
with:
2523
submodules: recursive
26-
token: ${{ secrets.GITHUB_TOKEN }}
24+
# Use PAT if repo is private; falls back to GITHUB_TOKEN for public repos.
25+
# Add secret INTRO_LECTURE_PAT (classic PAT with repo scope) in DHBern repo settings
26+
# if thodel/intro-lecture remains private.
27+
token: ${{ secrets.INTRO_LECTURE_PAT || secrets.GITHUB_TOKEN }}
28+
29+
- name: Configure git for HTTPS submodule access
30+
run: |
31+
git config --global url."https://${{ secrets.INTRO_LECTURE_PAT || github.token }}@github.com/".insteadOf "https://github.com/"
32+
git config --global url."https://${{ secrets.INTRO_LECTURE_PAT || github.token }}@github.com/".insteadOf "git@github.com:"
2733
2834
- name: Update intro-lecture submodule to latest
2935
run: |
3036
git submodule update --remote content/intro-lecture/_src
3137
git config user.name "github-actions[bot]"
3238
git config user.email "github-actions[bot]@users.noreply.github.com"
3339
if git diff --quiet; then
34-
echo "No submodule changes."
40+
echo "No submodule changes — skipping commit."
3541
else
36-
git add content/intro-lecture/_src
42+
git add content/intro-lecture/_src .gitmodules
3743
git commit -m "chore: update intro-lecture submodule [skip ci]"
3844
git push
3945
fi
4046
4147
- name: Setup Quarto
4248
uses: quarto-dev/quarto-actions/setup@v2
4349

44-
- name: Render site
45-
run: quarto render
46-
47-
- name: Deploy to GitHub Pages
48-
uses: peaceiris/actions-gh-pages@v4
49-
with:
50-
github_token: ${{ secrets.GITHUB_TOKEN }}
51-
publish_dir: ./_site
50+
- name: Render intro-lecture pages only
51+
run: |
52+
# Only render the intro-lecture subdirectory to avoid full site rebuild
53+
quarto render content/intro-lecture/ --output-dir ../../_site/intro-lecture/ 2>/dev/null || \
54+
quarto render content/intro-lecture/

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "content/intro-lecture/_src"]
22
path = content/intro-lecture/_src
3-
url = git@github.com:thodel/intro-lecture.git
3+
url = https://github.com/thodel/intro-lecture.git

0 commit comments

Comments
 (0)