Merge pull request #5 from sngular/Fix-plugin-version #11
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: Sync Docs (Merge) | |
on: | |
push: | |
branches: [main] | |
jobs: | |
check-pr-labels: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read | |
outputs: | |
labels: ${{ steps.get-pr.outputs.pr_labels }} | |
steps: | |
- name: Get Pull Request information | |
uses: 8BitJonny/[email protected] | |
id: get-pr | |
update-wiki: | |
runs-on: ubuntu-latest | |
needs: [check-pr-labels] | |
if: contains(needs.check-pr-labels.outputs.labels, 'documentation') | |
steps: | |
- name: Setup variables | |
run: | | |
echo "REPO_DEST=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}').wiki" >> $GITHUB_ENV | |
shell: bash | |
- name: Checkout SCS Pact Annotation Builder Plugin Repository | |
run: git clone https://github.com/sngular/pact-annotation-builder.git pact-annotation-builder | |
- name: Checkout SCS Pact Annotation Builder Plugin Wiki Repository | |
run: git clone https://github.com/sngular/pact-annotation-builder.wiki.git wiki | |
- name: Copy docs and consolidate links | |
run: | | |
cp -rf pact-annotation-builder/docs/* wiki/ | |
cd wiki | |
grep -lr "(.*\.md)" *|xargs -r sed -i 's/\.md//g' | |
echo ">" | |
git diff-index --quiet HEAD & git status -s | |
echo "<" | |
git status | |
echo ">" | |
git diff-index --quiet HEAD & git status -s | |
echo "<" | |
echo "TO_BE_CANCELLED=$(if [[ $(git diff-index --quiet HEAD & git status -s) ]]; then echo "false"; else echo "true"; fi)" >> $GITHUB_ENV | |
echo "$TO_BE_CANCELLED" | |
- name: Setup git user | |
if: ${{ env.TO_BE_CANCELLED == 'false' }} | |
run: | | |
git config --global user.name ${{ github.actor }} | |
- name: Sync Wiki | |
if: ${{ env.TO_BE_CANCELLED == 'false' }} | |
run: | | |
cd wiki | |
git status | |
git add . | |
git commit -m "pact-annotation-builder documentation | GitHub Actions $GITHUB_WORKFLOW $GITHUB_RUN_NUMBER" | |
git remote add origin-wiki "https://${{secrets.GITBOT_TOKEN}}@github.com/sngular/pact-annotation-builder.wiki.git" | |
git push origin-wiki main |