Skip to content

Commit 62cc059

Browse files
committed
Always check both license filename and type in "Check License" workflow
This might provide some additional useful information to the reader in the event of a failure.
1 parent fe1f528 commit 62cc059

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

.github/workflows/check-license.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,22 @@ jobs:
4646
# See: https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/licensing-a-repository
4747
- name: Check license file
4848
run: |
49+
EXIT_STATUS=0
4950
# See: https://github.com/licensee/licensee
5051
LICENSEE_OUTPUT="$(licensee detect --json --confidence=100)"
5152
5253
DETECTED_LICENSE_FILE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].filename | tr --delete '\r')"
5354
echo "Detected license file: $DETECTED_LICENSE_FILE"
5455
if [ "$DETECTED_LICENSE_FILE" != "\"${EXPECTED_LICENSE_FILENAME}\"" ]; then
5556
echo "ERROR: detected license file doesn't match expected: $EXPECTED_LICENSE_FILENAME"
56-
exit 1
57+
EXIT_STATUS=1
5758
fi
5859
5960
DETECTED_LICENSE_TYPE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].matched_license | tr --delete '\r')"
6061
echo "Detected license type: $DETECTED_LICENSE_TYPE"
6162
if [ "$DETECTED_LICENSE_TYPE" != "\"${EXPECTED_LICENSE_TYPE}\"" ]; then
6263
echo "ERROR: detected license type doesn't match expected $EXPECTED_LICENSE_TYPE"
63-
exit 1
64+
EXIT_STATUS=1
6465
fi
66+
67+
exit $EXIT_STATUS

0 commit comments

Comments
 (0)