Skip to content

Commit 58a6692

Browse files
committed
Implement a two-way mirroring between the wiki and its public repo
Previously, changes to the wiki would get merged to the public repo in a once-a-week action. This significantly revises this, making the two sides be mirrors (up to the few seconds it takes to do a merge). This is driven by a minimal-ish yaml file in both sides (`TypeScript` and `TypeScript-wiki`) that *always* works from the script in the public repo. The two action specs are nearly identical, but there are some differences: - On the main repo, trigger on a `gollum` event, and in the wiki repo the usual (pushes, schedule, manual). (The schedule run is kept as a just-in-case, and it's now running twice a week.) - The filename is `sync-wiki` on the TS side and just `sync` in the wiki. (Good to avoid confusion if both files somehow find themselves in the same neighborhood.) - The secret names are different since I used the name that already exists in each side. The script does *not* start with a checkout of its repository. Doing this in the TS side would be redundant (it would get the TS tree) and slow. Instead, it's always cloning the public wiki repo (`DASHREMOTE`, since its url is `.../TypeScript-wiki`) and then fetching into it the repo of the rendered wiki (`DOTREMOTE`, with a `.../TypeScript.wiki`) url. Also revised the README, since they should always be mirrored with this change, and therefore there is no "source of truth".
1 parent c4c6a83 commit 58a6692

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/sync-wiki.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Sync Two Wiki Repos
2+
3+
on: [gollum]
4+
5+
jobs:
6+
sync:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Get repo name
10+
run: R=${GITHUB_REPOSITORY%?wiki}; echo "BASENAME=${R##*/}" >> $GITHUB_ENV
11+
- name: Checkout ${{ env.BASENAME }}-wiki
12+
uses: actions/checkout@v2
13+
with:
14+
repository: "${{ GITHUB.repository_owner }}/${{ env.BASENAME }}-wiki"
15+
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
16+
fetch-depth: 0
17+
- name: Run sync
18+
run: ./.github/workflows/sync
19+
env:
20+
PUSHER: typescript-bot <[email protected]>
21+
AUTH: ${{ secrets.TS_BOT_GITHUB_TOKEN }}

0 commit comments

Comments
 (0)