Skip to content

Commit

Permalink
Add wiki sync logic to check for changes (#463)
Browse files Browse the repository at this point in the history
- Prevents errors when no changes detected since last run
  • Loading branch information
Kevin Rowlandson authored Sep 26, 2022
1 parent d247c79 commit 8639cd2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .github/workflows/wiki-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,18 @@ jobs:
rsync -avzr --delete --exclude='.git/' "$wiki_source_repo_dir/" "$wiki_target_repo"
working-directory: ${{ env.GITHUB_WORKSPACE }}

- name: Stage & Push Files Into Wiki Repo
- name: Check for changes
id: git_status
run: |
mapfile -t CHECK_GIT_STATUS < <(git status -s)
printf "%s\n" "${CHECK_GIT_STATUS[@]}"
echo "::set-output name=changes::${#CHECK_GIT_STATUS[@]}"
working-directory: ${{ env.wiki_target_repo }}

- name: Add files, commit and push into Wiki
if: steps.git_status.outputs.changes > 0
run: |
echo "Pushing changes to origin..."
git add .
git commit -m "$github_commit_message [$GITHUB_ACTOR/${GITHUB_SHA::8}]"
git push --set-upstream "https://$GITHUB_TOKEN@github.com/$wiki_target_repo.git" master
Expand Down

0 comments on commit 8639cd2

Please sign in to comment.