openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
.github/actions/check-uncommitted-changes/action.yml
35lines · modecode
| 1 | name: Check for uncommitted changes |
| 2 | description: Checks if there are any uncommitted changes in the repository |
| 3 | |
| 4 | inputs: |
| 5 | error-message: |
| 6 | description: 'Error message to display if uncommitted changes are found' |
| 7 | required: true |
| 8 | |
| 9 | runs: |
| 10 | using: composite |
| 11 | steps: |
| 12 | - name: Check for uncommitted changes |
| 13 | shell: bash |
| 14 | run: | |
| 15 | ERROR_MSG="${{ inputs.error-message }}" |
| 16 | |
| 17 | # Check if there are any changes to tracked files |
| 18 | if ! git diff --quiet; then |
| 19 | echo "::error::$ERROR_MSG" |
| 20 | echo "Changed files:" |
| 21 | git diff --name-only |
| 22 | echo "Diff details:" |
| 23 | git diff |
| 24 | exit 1 |
| 25 | fi |
| 26 | |
| 27 | # Also check for untracked files that might have been generated |
| 28 | if [ -n "$(git ls-files --others --exclude-standard)" ]; then |
| 29 | echo "::error::$ERROR_MSG" |
| 30 | echo "Untracked files:" |
| 31 | git ls-files --others --exclude-standard |
| 32 | exit 1 |
| 33 | fi |
| 34 | |
| 35 | echo "No uncommitted changes detected!" |
| 36 | |