Skip to content

Commit

Permalink
try to handle grep exit gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicente Canales committed Dec 12, 2023
1 parent 39ad668 commit 93d74a1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/add-strict-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ jobs:
- name: Check for new PHP files
id: check
run: |
git fetch origin +refs/heads/trunk:refs/remotes/origin/trunk
NEW_PHP_FILES=$(git diff --name-only refs/remotes/origin/trunk HEAD -- '*.php' | xargs -r grep -LE 'declare\( strict_types=1 \)')
git fetch origin +refs/heads/trunk:refs/remotes/origin/trunk --quiet
NEW_PHP_FILES=$(git diff --name-only refs/remotes/origin/trunk HEAD -- '*.php' | xargs -r grep -LE 'declare\( strict_types=1 \)' || true)
if [ -n "$NEW_PHP_FILES" ]; then
echo "::set-output name=strict_types_needed::true"
echo "New PHP files without strict types: $NEW_PHP_FILES"
else
echo "::set-output name=strict_types_needed::false"
fi
- name: Add strict types to new PHP files
if: steps.check.outputs.strict_types_needed == 'true'
Expand Down

0 comments on commit 93d74a1

Please sign in to comment.