-
Notifications
You must be signed in to change notification settings - Fork 55
86 lines (72 loc) · 2.67 KB
/
update-wiki.yml
File metadata and controls
86 lines (72 loc) · 2.67 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Update Wiki Pages
on:
workflow_dispatch:
inputs:
skip_oci_images:
description: 'Skip OCI image checks to reduce HTTP calls'
required: false
default: false
type: boolean
push:
branches:
- main
- 'release-*'
paths:
- 'workspaces/**'
- 'versions.json'
permissions:
contents: write
jobs:
update-wiki:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: '24'
- name: Install dependencies
run: |
npm install js-yaml
- name: Get branch name
id: branch
run: |
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
# Sanitize branch name for filename (replace / with -)
SAFE_BRANCH_NAME="${BRANCH_NAME//\//-}"
echo "name=${BRANCH_NAME}" >> $GITHUB_OUTPUT
echo "safe_name=${SAFE_BRANCH_NAME}" >> $GITHUB_OUTPUT
echo "Branch: ${BRANCH_NAME}"
- name: Generate wiki content
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const script = require('./.github/workflows/github-script/generate-wiki-page.js');
const branchName = '${{ github.ref }}'.replace('refs/heads/', '');
const isMainOrRelease = branchName === 'main' || branchName.startsWith('release-');
const checkOciImages = isMainOrRelease;
await script({github, context, core, checkOciImages});
- name: Checkout wiki repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: ${{ github.repository }}.wiki
path: wiki
token: ${{ secrets.GITHUB_TOKEN }}
- name: Copy generated wiki page to wiki repo
run: |
cp "${{ steps.branch.outputs.safe_name }}.md" wiki/
- name: Commit and push wiki changes
working-directory: wiki
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Add the file first
git add "${{ steps.branch.outputs.safe_name }}.md"
# Check if there are changes (after staging)
if git diff --cached --quiet; then
echo "No changes to commit"
exit 0
fi
git commit -m "Update ${{ steps.branch.outputs.name }} workspace status [automated]"
git push