|
1 |
| -# Based on https://www.growingwiththeweb.com/2016/07/enabling-pull-requests-on-github-wikis.html |
| 1 | +# Roughly based on |
| 2 | +# https://www.growingwiththeweb.com/2016/07/enabling-pull-requests-on-github-wikis.html |
| 3 | + |
2 | 4 | name: Sync Two Wiki Repos
|
3 | 5 |
|
4 | 6 | on:
|
5 |
| - # Merged PRs |
6 |
| - push: |
7 |
| - branches: [master] |
8 |
| - # Weekly |
9 |
| - schedule: |
10 |
| - # https://crontab.guru/#0_12_*_*_1 |
11 |
| - - cron: "0 12 * * 1" |
12 |
| - # Whenever someone asks |
13 |
| - workflow_dispatch: |
| 7 | + push: {branches: [master]} |
| 8 | + schedule: [{cron: "7 0 * * 1,3"}] # https://crontab.guru/#7_0_*_*_1,3 |
| 9 | + workflow_dispatch: # on request |
14 | 10 |
|
15 | 11 | jobs:
|
16 | 12 | sync:
|
17 | 13 | runs-on: ubuntu-latest
|
18 | 14 | steps:
|
19 |
| - - uses: actions/checkout@v1 |
20 |
| - |
21 |
| - # Setup Git |
22 |
| - - run: git config user.name "typescript-bot" |
23 |
| - - run: git config user.email "bot@typescriptlang.org" |
24 |
| - |
25 |
| - # Replace remotes with auth'd versions, then pull the .wiki version (the one people can't PR to) |
26 |
| - # then merge in any changes from here and push |
27 |
| - - |
28 |
| - run: | |
29 |
| - git remote remove origin |
30 |
| - git remote add origin https://$GITHUB_TOKEN@github.com/microsoft/TypeScript-wiki.git |
31 |
| - git remote add upstream https://$GITHUB_TOKEN@github.com/microsoft/TypeScript.wiki.git |
32 |
| - git fetch origin |
33 |
| - git fetch upstream |
34 |
| - git merge upstream/master --no-edit |
35 |
| - git push origin HEAD:master |
36 |
| - git push upstream HEAD:master |
37 |
| - env: |
38 |
| - GITHUB_TOKEN: ${{ secrets.TS_BOT_TOKEN }} |
39 |
| - |
| 15 | + - name: Get repo name |
| 16 | + run: R=${GITHUB_REPOSITORY%?wiki}; echo "BASENAME=${R##*/}" >> $GITHUB_ENV |
| 17 | + - name: Checkout ${{ env.BASENAME }}-wiki |
| 18 | + uses: actions/checkout@v2 |
| 19 | + with: |
| 20 | + repository: "${{ GITHUB.repository_owner }}/${{ env.BASENAME }}-wiki" |
| 21 | + token: ${{ secrets.TS_BOT_TOKEN }} |
| 22 | + fetch-depth: 0 |
| 23 | + - name: Run sync |
| 24 | + run: ./.github/workflows/sync |
| 25 | + env: |
| 26 | + PUSHER: typescript-bot <bot@typescriptlang.org> |
| 27 | + AUTH: ${{ secrets.TS_BOT_TOKEN }} |
0 commit comments