Skip to content

Commit

Permalink
Add -uo pipefail for CI scripts
Browse files Browse the repository at this point in the history
And switch to || true instead of | true

Necessary to stop on errors in pipes in get_translators_to_check
  • Loading branch information
dstillman committed Feb 1, 2021
1 parent d50a2da commit 1fbd2fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .ci/helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ get_translators_to_check() {
# Push to master
if [ "${GITHUB_REF:-}" = "refs/heads/master" ]; then
local before_commit=$(jq -r '.before' $(echo $GITHUB_EVENT_PATH))
TRANSLATORS_TO_CHECK=$(git diff $before_commit --name-only | { grep -e "^[^/]*.js$" | true; })
TRANSLATORS_TO_CHECK=$(git diff $before_commit --name-only | { grep -e "^[^/]*.js$" || true; })
# Pull request
else
# Gets parent commits. Either one or two hashes
local parent_commits=($(git show --no-patch --format="%P" HEAD))
# Size of $parent_commits array
local num_parent_commits=${#parent_commits[@]}
if [ $num_parent_commits -gt 1 ]; then
TRANSLATORS_TO_CHECK=$(git diff HEAD^2 $(git rev-list "$(git rev-list --first-parent ^origin/master HEAD^2 | tail -n1)^^!") --name-only | { grep -e "^[^/]*.js$" | true; })
TRANSLATORS_TO_CHECK=$(git diff HEAD^2 $(git rev-list "$(git rev-list --first-parent ^master HEAD^2 | tail -n1)^^!") --name-only | { grep -e "^[^/]*.js$" || true; })
else
TRANSLATORS_TO_CHECK=$(git diff $(git rev-list "$(git rev-list --first-parent ^origin/master HEAD | tail -n1)^^!") --name-only | { grep -e "^[^/]*.js$" | true; })
TRANSLATORS_TO_CHECK=$(git diff $(git rev-list "$(git rev-list --first-parent ^master HEAD | tail -n1)^^!") --name-only | { grep -e "^[^/]*.js$" || true; })
fi
fi
}
2 changes: 1 addition & 1 deletion .ci/lint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e
set -euo pipefail

dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

Expand Down
2 changes: 1 addition & 1 deletion .ci/pull-request-check/check-pull-request.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e
set -euo pipefail

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT_DIR="$( dirname "$DIR" )"
Expand Down

0 comments on commit 1fbd2fd

Please sign in to comment.