Skip to content

Commit

Permalink
Fail when there are changes
Browse files Browse the repository at this point in the history
  • Loading branch information
GomathiselviS committed Feb 22, 2024
1 parent 682e749 commit a491c9b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/generate_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ jobs:
- name: Generate documentation
run: make generatedocs

- name: Use GITHUB_TOKEN to commit changes
- name: Check for doc changes
run: |
git diff --exit-code || (echo "Generated docs have changed, committing the changes." && git config user.name "${{ github.repository_owner }}" && git -c "user.name=${{ github.actor }}" -c "user.email=${{ github.actor }}@users.noreply.github.com" commit -am "Update generated docs (${GITHUB_SHA})" && git push origin HEAD:${{ github.head_ref }})
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if git diff --exit-code; then
echo "Docs generation successful, no changes found."
else
echo "Error: Uncommitted changes found. Please commit or discard changes before generating docs."
exit 1
fi

0 comments on commit a491c9b

Please sign in to comment.