Repository navigation
65 lines (56 loc) · 1.72 KB
/
Copy pathupdate-wiki.yml
File metadata and controls
65 lines (56 loc) · 1.72 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Update Wiki
on:
workflow_dispatch:
inputs:
publish:
description: "Publish docs/wiki to the GitHub Wiki repository"
required: true
default: "false"
type: choice
options:
- "false"
- "true"
jobs:
update-wiki:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate wiki pages
run: pnpm build
- name: Validate wiki freshness
run: pnpm validate
- name: Upload wiki artifact
uses: actions/upload-artifact@v4
with:
name: open-problem-lab-wiki
path: docs/wiki
- name: Publish to GitHub Wiki
if: inputs.publish == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
rm -rf /tmp/open-problem-lab-wiki
git clone "https://x-access-token:${GH_TOKEN}@github.com/${REPOSITORY}.wiki.git" /tmp/open-problem-lab-wiki
rsync -a --delete docs/wiki/ /tmp/open-problem-lab-wiki/
cd /tmp/open-problem-lab-wiki
git add .
git diff --cached --quiet || git commit -m "Update generated wiki"
git push