Skip to content

Commit

Permalink
Fix build check script
Browse files Browse the repository at this point in the history
Fix an issue where grep exited with exit code 1 when no lines matched
the final pattern.  Not matching any lines is the expected behavior, but
the variable should be populated with empty string instead of causing
the shell to exit (because of `set -e`).

In addition, do not install dev dependencies since they are not needed
  • Loading branch information
cookieguru committed Apr 13, 2024
1 parent d15fefb commit a0df2c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ changes=$(
grep -v "^ M docs/sitemap\.xml$" |
# the following two are specific to GitHub Actions
grep -v "^.. output\.log$" |
grep -vi "^.. Docker"
grep -vi "^.. Docker" || true # force grep to exit 0, even if no lines match
)

if [[ -n "$changes" ]]; then
if [ -n "$changes" ]; then
echo "\e[31mYou forgot to commit changes to the docs dir!\e[0m"
echo 'On your local run \e[33mcomposer build\e[0m then \e[33mgit add\e[0m your changes to the docs dir'
echo 'Then \e[33mgit commit --amend\e[0m and \e[33mgit push --force\e[0m'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- name: Install dependencies
uses: php-actions/composer@v6
with:
dev: no
php_version: 8.3

- name: Check for uncommitted files
Expand Down

0 comments on commit a0df2c5

Please sign in to comment.