-
Notifications
You must be signed in to change notification settings - Fork 1
38 lines (35 loc) · 1.4 KB
/
publish_docs_to_wiki.yml
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
name: Publish docs to Wiki
# Trigger this action only if there are changes pushed to the docs/** directory under the main branch
on:
push:
paths:
- docs/** # This includes all sub folders
branches:
- main # This can be changed to any branch of your preference
env:
USER_TOKEN: ${{ secrets.WIKI_ACTION_TOKEN }} # This is the repository secret
USER_NAME: ${{ secrets.WIKI_ACTION_USER }} # Enter the username of your (bot) account
USER_EMAIL: ${{ secrets.WIKI_ACTION_EMAIL }} # Enter the e-mail of your (bot) account
OWNER: ${{ github.event.repository.owner.name }} # This is the repository owner
REPOSITORY_NAME: ${{ github.event.repository.name }} # This is the repository name
jobs:
publish_docs_to_wiki:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Pull content from wiki
run: |
mkdir tmp_wiki
cd tmp_wiki
git init
git config user.name $USER_NAME
git config user.email $USER_EMAIL
git pull https://$USER_TOKEN@github.com/$OWNER/$REPOSITORY_NAME.wiki.git
- name: Push content to wiki
run: |
rsync -av --delete docs/ tmp_wiki/ --exclude .git
cd tmp_wiki
git add .
git commit -m "Update Wiki content"
git push -f --set-upstream https://$USER_TOKEN@github.com/$OWNER/$REPOSITORY_NAME.wiki.git master