test doc #16
Workflow file for this run
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: Auto-approve Docs | |
on: | |
pull_request: | |
paths: | |
- 'apilib/docs/**/*.md' | |
jobs: | |
approve-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 100 | |
- name: Check for non-docs file changes | |
run: | | |
# List all files changed in this push | |
CHANGED_FILES=$(git diff --name-only $(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}) ${{ github.event.pull_request.head.sha }}) | |
echo "• Changed files in this PR:" | |
echo "$CHANGED_FILES" | |
# Check if any changes were made outside the 'apilib/docs/**/*.md' path | |
set +e # Disable exit on error temporarily | |
UNWANTED_FILES=$(echo "$CHANGED_FILES" | grep -Ev '^apilib/docs/.*\.md$') | |
set -e # Re-enable exit on error | |
if [ -n "$UNWANTED_FILES" ]; then | |
echo "• Changes detected outside doc site files" | |
echo "$UNWANTED_FILES" | |
echo "• Stopping workflow - this PR can not be auto-approved." | |
exit 1 # Exit with a non-zero code to stop the workflow | |
fi | |
- uses: hmarr/auto-approve-action@v4 | |
with: | |
review-message: "Auto approved automated PR from docs workflow" |