Skip to content

Commit 3a5826a

Browse files
committed
Simplify license check CI system
Now that the parser tool is moved out of the repository, it makes less sense to use the taskfile-based approach for the CI infrastructure. In order to make the repository more contributor-friendly, the license checking system is now confined to a single workflow file.
1 parent d38ccc8 commit 3a5826a

File tree

2 files changed

+32
-43
lines changed

2 files changed

+32
-43
lines changed

.github/workflows/check-license.yml

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
name: Check license
22

3+
env:
4+
EXPECTED_LICENSE_FILENAME: LICENSE.txt
5+
# SPDX identifier: https://spdx.org/licenses/
6+
EXPECTED_LICENSE_TYPE: GPL-3.0
7+
38
on:
49
push:
510
paths:
611
- ".github/workflows/check-license.yml"
7-
- "Taskfile.yml"
812
# Recognized license files. See: https://github.com/licensee/licensee/blob/master/docs/what-we-look-at.md#detecting-the-license-file
9-
- "COPYING*"
10-
- "LICENCE*"
11-
- "LICENSE*"
13+
- "[cC][oO][pP][yY][iI][nN][gG]*"
14+
- "[cC][oO][pP][yY][rR][iI][gG][hH][tH]*"
15+
- "[lL][iI][cC][eE][nN][cCsS][eE]*"
16+
- "[oO][fF][lL]*"
17+
- "[pP][aA][tT][eE][nN][tT][sS]*"
1218
pull_request:
1319
paths:
1420
- ".github/workflows/check-license.yml"
15-
- "Taskfile.yml"
16-
# Recognized license files. See: https://github.com/licensee/licensee/blob/master/docs/what-we-look-at.md#detecting-the-license-file
17-
- "COPYING*"
18-
- "LICENCE*"
19-
- "LICENSE*"
21+
- "[cC][oO][pP][yY][iI][nN][gG]*"
22+
- "[cC][oO][pP][yY][rR][iI][gG][hH][tH]*"
23+
- "[lL][iI][cC][eE][nN][cCsS][eE]*"
24+
- "[oO][fF][lL]*"
25+
- "[pP][aA][tT][eE][nN][tT][sS]*"
2026

2127
jobs:
2228
check:
@@ -26,12 +32,6 @@ jobs:
2632
- name: Checkout local repository
2733
uses: actions/checkout@v2
2834

29-
- name: Install Taskfile
30-
uses: arduino/actions/setup-taskfile@master
31-
with:
32-
repo-token: ${{ secrets.GITHUB_TOKEN }}
33-
version: 3.x
34-
3535
- uses: ruby/setup-ruby@v1
3636
with:
3737
ruby-version: ruby # Install latest version
@@ -41,4 +41,20 @@ jobs:
4141

4242
# See: https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/licensing-a-repository
4343
- name: Check license file
44-
run: task --silent docs:check-license
44+
run: |
45+
# See: https://github.com/licensee/licensee
46+
LICENSEE_OUTPUT="$(licensee detect --json --confidence=100)"
47+
48+
DETECTED_LICENSE_FILE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].filename | tr --delete '\r')"
49+
echo "Detected license file: $DETECTED_LICENSE_FILE"
50+
if [ "$DETECTED_LICENSE_FILE" != "\"$EXPECTED_LICENSE_FILENAME\"" ]; then
51+
echo "ERROR: detected license file doesn't match expected: $EXPECTED_LICENSE_FILENAME"
52+
exit 1
53+
fi
54+
55+
DETECTED_LICENSE_TYPE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].matched_license | tr --delete '\r')"
56+
echo "Detected license type: $DETECTED_LICENSE_TYPE"
57+
if [ "$DETECTED_LICENSE_TYPE" != "\"$EXPECTED_LICENSE_TYPE\"" ]; then
58+
echo "ERROR: detected license type doesn't match expected $EXPECTED_LICENSE_TYPE"
59+
exit 1
60+
fi

Taskfile.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)