1
0
mirror of https://github.com/arduino/library-registry.git synced 2025-07-29 14:01:15 +03:00

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.
This commit is contained in:
per1234
2021-08-11 03:19:13 -07:00
parent e9352f1e53
commit e0c4b766d5

View File

@ -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