Repository navigation
68 lines (61 loc) · 2.59 KB
/
Copy pathwiki-sync.yml
File metadata and controls
68 lines (61 loc) · 2.59 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
# Publish the README, cut by heading, and docs/ to the GitHub wiki whenever master changes them.
#
# scripts/wiki-sync.sh builds the pages and scripts/wiki-publish.sh commits and pushes them. Red
# means the wiki is stale: the sync failing (a broken link, a stale name in docs/.wikisections or
# docs/.wikiignore) and the push failing both exit non-zero, and nothing is retried. A run with
# nothing to change is green and its summary says so.
#
# The wiki has to be switched on in the repository settings and given a first page (Home) before
# the first run, since the wiki repository does not exist until then. Until it is, the wiki
# checkout below fails.
#
# Not a required check. It runs after the merge, so there is nothing left for it to block.
name: wiki sync
on:
push:
branches: [master]
paths:
- "README.md"
- "docs/**"
- "scripts/wiki-sync.sh"
- "scripts/wiki-publish.sh"
- ".github/workflows/wiki-sync.yml"
workflow_dispatch:
permissions: {}
# One run at a time, in order, and a run in progress is left to finish. Every run publishes the tip
# of master, not the commit that started it, so whichever run is last leaves the wiki matching it.
concurrency:
group: wiki-sync
cancel-in-progress: false
jobs:
publish:
name: Publish docs to the wiki
# A fork has its own wiki or none, and the generated pages link to this repository.
if: github.repository == 'BaryoDev/barakoPress'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
# Pushing to <repository>.wiki.git with GITHUB_TOKEN needs contents: write, and there is no
# narrower scope that covers only the wiki.
contents: write
steps:
# The tip of master rather than the commit that started the run, so a rerun of an old run
# cannot put older docs back over newer ones. No token kept: nothing writes to this repository.
- name: Check out master
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: master
path: source
persist-credentials: false
# This checkout keeps the token, because the push goes to it.
- name: Check out the wiki
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ github.repository }}.wiki
path: wiki
persist-credentials: true
- name: Sync, commit and push
env:
WIKI_COMMIT_NAME: "github-actions[bot]"
WIKI_COMMIT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
run: bash source/scripts/wiki-publish.sh wiki