From 58a6692ef0604aac484689f5f52275c4f48adb23 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Fri, 21 May 2021 16:44:02 -0400 Subject: [PATCH] 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". --- .github/workflows/sync-wiki.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/sync-wiki.yml diff --git a/.github/workflows/sync-wiki.yml b/.github/workflows/sync-wiki.yml new file mode 100644 index 00000000000..a10335070b0 --- /dev/null +++ b/.github/workflows/sync-wiki.yml @@ -0,0 +1,21 @@ +name: Sync Two Wiki Repos + +on: [gollum] + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - name: Get repo name + run: R=${GITHUB_REPOSITORY%?wiki}; echo "BASENAME=${R##*/}" >> $GITHUB_ENV + - name: Checkout ${{ env.BASENAME }}-wiki + uses: actions/checkout@v2 + with: + repository: "${{ GITHUB.repository_owner }}/${{ env.BASENAME }}-wiki" + token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} + fetch-depth: 0 + - name: Run sync + run: ./.github/workflows/sync + env: + PUSHER: typescript-bot + AUTH: ${{ secrets.TS_BOT_GITHUB_TOKEN }}