From e0c4b766d52e2072a30405b0c7b009cfe5d5e005 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 11 Aug 2021 03:19:13 -0700 Subject: [PATCH] Always check both license filename and type in "Check License" workflow This might provide some additional useful context to the reader in the event of a failure. --- .github/workflows/check-license.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-license.yml b/.github/workflows/check-license.yml index 4cf2a96e..6356b4fd 100644 --- a/.github/workflows/check-license.yml +++ b/.github/workflows/check-license.yml @@ -46,6 +46,7 @@ jobs: - name: Check license file run: | + EXIT_STATUS=0 # See: https://github.com/licensee/licensee LICENSEE_OUTPUT="$(licensee detect --json --confidence=100)" @@ -53,12 +54,14 @@ jobs: echo "Detected license file: $DETECTED_LICENSE_FILE" if [ "$DETECTED_LICENSE_FILE" != "\"$EXPECTED_LICENSE_FILENAME\"" ]; then echo "ERROR: detected license file doesn't match expected: $EXPECTED_LICENSE_FILENAME" - exit 1 + EXIT_STATUS=1 fi DETECTED_LICENSE_TYPE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].matched_license | tr --delete '\r')" echo "Detected license type: $DETECTED_LICENSE_TYPE" if [ "$DETECTED_LICENSE_TYPE" != "\"$EXPECTED_LICENSE_TYPE\"" ]; then echo "ERROR: detected license type doesn't match expected $EXPECTED_LICENSE_TYPE" - exit 1 + EXIT_STATUS=1 fi + + exit $EXIT_STATUS