Skip to content

Commit 09f41b5

Browse files
authored
Update pages.yml
1 parent 664c776 commit 09f41b5

1 file changed

Lines changed: 36 additions & 24 deletions

File tree

.github/workflows/pages.yml

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,28 @@ jobs:
3434
if [ ! -f LICENSE ]; then
3535
YEAR=$(date +%Y)
3636
cat > LICENSE <<EOF
37-
MIT License
38-
39-
Copyright (c) $YEAR Steph Buongiorno
40-
41-
Permission is hereby granted, free of charge, to any person obtaining a copy
42-
of this software and associated documentation files (the "Software"), to deal
43-
in the Software without restriction, including without limitation the rights
44-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
45-
copies of the Software, and to permit persons to whom the Software is
46-
furnished to do so, subject to the following conditions:
47-
48-
The above copyright notice and this permission notice shall be included in all
49-
copies or substantial portions of the Software.
50-
51-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
53-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
54-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
55-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
56-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
57-
SOFTWARE.
58-
EOF
37+
MIT License
38+
39+
Copyright (c) ${YEAR} Steph Buongiorno
40+
41+
Permission is hereby granted, free of charge, to any person obtaining a copy
42+
of this software and associated documentation files (the "Software"), to deal
43+
in the Software without restriction, including without limitation the rights
44+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
45+
copies of the Software, and to permit persons to whom the Software is
46+
furnished to do so, subject to the following conditions:
47+
48+
The above copyright notice and this permission notice shall be included in all
49+
copies or substantial portions of the Software.
50+
51+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
53+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
54+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
55+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
56+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
57+
SOFTWARE.
58+
EOF
5959
echo "MIT License generated."
6060
echo "created=true" >> "$GITHUB_OUTPUT"
6161
else
@@ -87,6 +87,7 @@ jobs:
8787
HOMELINK="https://democracy-lab.github.io/"
8888
REPO_URL="https://github.com/$OWNER/$REPO_NAME"
8989
90+
# Minimal Pandoc template
9091
cat > pandoc_template.html <<'TPL'
9192
<!doctype html>
9293
<html>
@@ -111,11 +112,18 @@ jobs:
111112
echo "Keeping existing index.html (not regenerating)."
112113
elif [ -f README.md ]; then
113114
echo "Generating index.html from README.md..."
114-
pandoc README.md -f markdown -t html -s --template=pandoc_template.html -o index.html --metadata title="$REPO_HTML_TITLE"
115+
pandoc README.md -f markdown -t html -s \
116+
--template=pandoc_template.html \
117+
-o index.html \
118+
--metadata title="$REPO_HTML_TITLE"
115119
GENERATED=1
116120
else
117121
echo "No index.html or README.md found; writing minimal page."
118-
printf '%s\n' '<!doctype html><html><head><meta charset="utf-8"><title>Site</title></head><body>' '<h1>Site</h1>' '<p>No README.md found. Add one and push to regenerate this page.</p>' '</body></html>' > index.html
122+
printf '%s\n' \
123+
'<!doctype html><html><head><meta charset="utf-8"><title>Site</title></head><body>' \
124+
'<h1>Site</h1>' \
125+
'<p>No README.md found. Add one and push to regenerate this page.</p>' \
126+
'</body></html>' > index.html
119127
GENERATED=1
120128
fi
121129
@@ -139,11 +147,13 @@ jobs:
139147
}
140148
</style>'
141149
150+
# Inject CSS into <head>
142151
if grep -qi '</head>' index.html; then
143152
awk -v css="$CSS" 'BEGIN{IGNORECASE=1} { if (!done && match(tolower($0), /<\/head>/)) { sub(/<\/head>/, css"</head>"); done=1 } print }' index.html > index.html.tmp
144153
mv index.html.tmp index.html
145154
fi
146155
156+
# Wrap with sidebar + container
147157
if grep -qi '<div class="page"' index.html; then
148158
echo "Wrapper already present; skipping."
149159
else
@@ -175,6 +185,7 @@ jobs:
175185
LAST_UPDATE=$(git log -1 --format=%cI || date -u +%Y-%m-%dT%H:%M:%SZ)
176186
YEAR=$(date -u -d "$LAST_UPDATE" +%Y 2>/dev/null || date -u +%Y)
177187
188+
# Gather human contributors
178189
logins=$(curl -s -H "Authorization: Bearer $GH_TOKEN" \
179190
"https://api.github.com/repos/$REPO/contributors?per_page=100&anon=false" \
180191
| jq -r '.[] | select((.type // "") != "Bot") | select(.login != "ghost") | .login' | sort -fu)
@@ -260,3 +271,4 @@ jobs:
260271
uses: actions/deploy-pages@v4
261272

262273

274+

0 commit comments

Comments
 (0)