Skip to content

Commit

Permalink
Use bash strict mode in license check script (openxla#2038)
Browse files Browse the repository at this point in the history
When I added the script in
openxla#2018, I bootstrapped it from a
script that didn't use strict mode. Around the same time, I sent
openxla#2012 for review, but forgot to
apply the change to this new script as well.

Also, change the condition on whether UNLICENSED_FILES contains any
elements to avoid triggering nounset.
  • Loading branch information
mlevesquedion authored Feb 23, 2024
1 parent 115941b commit 4e463ed
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion build_tools/github_actions/lint_check_license.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail

print_usage() {
echo "Usage: $0 [-b]"
echo " -b <branch> Base branch name, defaults to main."
Expand Down Expand Up @@ -77,7 +81,7 @@ for file in "${CHANGED_FILES[@]}"; do
fi
done

if (( ${#UNLICENSED_FILES} )); then
if (( ${#UNLICENSED_FILES[@]} )); then
echo "Found unlicensed files:
$(printf "%s\n" "${UNLICENSED_FILES[@]}")"
exit 1
Expand Down

0 comments on commit 4e463ed

Please sign in to comment.