Created
February 14, 2024 19:39
-
-
Save hankadev/996c7c7734e66d274b574afc51e6afe1 to your computer and use it in GitHub Desktop.
a simple PR workflow that checks if I forgot remove .only in any file
This file contains hidden or 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: PR checks | |
| on: | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| check-only: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for .only in changed JavaScript and TypeScript files | |
| run: | | |
| changed_files=$(git diff --name-only origin/main) | |
| for file in $changed_files | |
| do | |
| if [[ $file == *.js || $file == *.jsx || $file == *.ts || $file == *.tsx ]] | |
| then | |
| if grep -q ".only(" $file | |
| then | |
| echo "File $file contains .only(" | |
| exit 1 | |
| fi | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment