Skip to content

Instantly share code, notes, and snippets.

@hankadev
Created February 14, 2024 19:39
Show Gist options
  • Select an option

  • Save hankadev/996c7c7734e66d274b574afc51e6afe1 to your computer and use it in GitHub Desktop.

Select an option

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
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