wiki_edited #59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: wiki_edited | |
on: | |
gollum | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: setup repo | |
run: | | |
git remote add wiki https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.wiki.git | |
git fetch wiki | |
- name: push branch | |
run: | | |
# there is a race condition if this runs between wiki edit and a push from somewhere else | |
# then the edit will be lost | |
git checkout wiki/master | |
export branch_name=$(mktemp -u pr_XXXXXXXXXXXXXX) | |
echo "branch_name=${branch_name}" >> $GITHUB_ENV | |
git checkout -b $branch_name | |
git push origin $branch_name | |
- uses: repo-sync/pull-request@v2 | |
with: | |
source_branch: "${{ env.branch_name }}" | |
destination_branch: "master" | |
pr_title: "Edited ${{ github.event.pages[0].title }}" | |
pr_body: "Opened from wiki edit" | |
pr_draft: false | |
pr_allow_empty: true | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: revert changes to wiki | |
run: | | |
git push wiki master --force |