Skip to content

Commit

Permalink
feat: Add path options for check-license.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
aliphys committed Nov 21, 2023
1 parent 98c5a4b commit 84737a4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions workflow-templates/check-license.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Install the [`check-license.yml`](check-license.yml) GitHub Actions workflow to

- Configure the license filename in the `env.EXPECTED_LICENSE_FILENAME` field of `check-license.yml`.
- Configure the license type in the `env.EXPECTED_LICENSE_TYPE` field of `check-license.yml`.
- (Optional) If license files should be present outisde the root directory, configure additional `path:` locations.

### Readme badge

Expand Down
16 changes: 15 additions & 1 deletion workflow-templates/check-license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ jobs:
permissions:
contents: read

strategy:
fail-fast: false

matrix:
module:
#TODO Add additional paths where license files should be
- path:

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -78,12 +86,18 @@ jobs:
- name: Install licensee
run: gem install licensee

- name: Check license file
- name: Check license file for ${{ matrix.module.path }}
run: |
EXIT_STATUS=0
# Go into folder path
cd ./${{ matrix.module.path }}
# See: https://github.com/licensee/licensee
LICENSEE_OUTPUT="$(licensee detect --json --confidence=100)"
DETECTED_LICENSE_FILE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].filename | tr --delete '\r')"
echo "Detected license file: $DETECTED_LICENSE_FILE"
if [ "$DETECTED_LICENSE_FILE" != "\"${EXPECTED_LICENSE_FILENAME}\"" ]; then
Expand Down

0 comments on commit 84737a4

Please sign in to comment.