test just doc update #13
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 | |
UNWANTED_FILES=$(echo "$CHANGED_FILES" | grep -Ev '^apilib/docs/.*\.md$') | |
# Check the size and content of UNWANTED_FILES | |
echo "• Size of UNWANTED_FILES:" | |
echo "$UNWANTED_FILES" | wc | |
echo "• Content of UNWANTED_FILES:" | |
echo "$UNWANTED_FILES" | |
# Store the result of the check in a variable | |
UNWANTED_FILES_CHECK=$( [ -n "$UNWANTED_FILES" ] && echo "true" || echo "false" ) | |
# Debug the variable | |
echo "• UNWANTED_FILES_CHECK: $UNWANTED_FILES_CHECK" | |
if [ "$UNWANTED_FILES_CHECK" = "true" ]; 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 | |
else | |
echo "• No unwanted file changes detected" | |
fi | |
- uses: hmarr/auto-approve-action@v4 | |
with: | |
review-message: "Auto approved automated PR from docs workflow" |