Skip to content

Commit bb5d778

Browse files
authored
[skip changelog] Standardize license file (#1522)
* [skip changelog] Standardize license file Standardization in license documentation is important because, in addition to making it easy for humans to find this vital information, it allows machines to automate the process of license type determination, which is useful both for discovering suitable open source projects as well as checking open source license compliance. The open source license of Arduino CLI is already stored in a standardized location at `/LICENSE.txt`. However, even though Arduino CLI is licensed under the industry standard GPL 3.0 open source license, additional text was added to the license file which offers the option to purchase an exception for proprietary use of the code. Even though this offer does not have any legal effect on the GPL 3.0 license, it does make it so that the license file can no longer be identified with 100% confidence by machines as GPL 3.0, which means a human must make that identification instead. Since there is no need to place the exception offer in the license file, it can be moved to the readme and the license file left as the verbatim GPL 3.0 license text, as looked for by the license type detection tools such as licensee. * Add CI workflow to check the license file Whenever one of the recognized license file names are modified in the repository, the workflow runs to check whether the license can be recognized and whether it is of the expected type. GitHub has a useful automated license detection system that determines the license type used by a repository, and surfaces that information in the repository home page, the search web interface, and the GitHub API. This license detection system requires that the license be defined by a dedicated file with one of several standardized filenames and paths. GitHub's license detection system uses the popular licensee tool, so this file also serves to define the license type for any other usages of licensee, as well as to human readers of the file. For this reason, and to ensure it remains a valid legal instrument, it's important that there be no non-standard modifications to the license file or collisions with other supported licence files. This workflow ensures that any changes which would change the license type or which license file is used by the detection are caught automatically.
1 parent 7b468c0 commit bb5d778

File tree

3 files changed

+77
-14
lines changed

3 files changed

+77
-14
lines changed

Diff for: .github/workflows/check-license.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-license.md
2+
name: Check License
3+
4+
env:
5+
EXPECTED_LICENSE_FILENAME: LICENSE.txt
6+
# SPDX identifier: https://spdx.org/licenses/
7+
EXPECTED_LICENSE_TYPE: GPL-3.0
8+
9+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
10+
on:
11+
push:
12+
paths:
13+
- ".github/workflows/check-license.ya?ml"
14+
# See: https://github.com/licensee/licensee/blob/master/docs/what-we-look-at.md#detecting-the-license-file
15+
- "[cC][oO][pP][yY][iI][nN][gG]*"
16+
- "[cC][oO][pP][yY][rR][iI][gG][hH][tH]*"
17+
- "[lL][iI][cC][eE][nN][cCsS][eE]*"
18+
- "[oO][fF][lL]*"
19+
- "[pP][aA][tT][eE][nN][tT][sS]*"
20+
pull_request:
21+
paths:
22+
- ".github/workflows/check-license.ya?ml"
23+
- "[cC][oO][pP][yY][iI][nN][gG]*"
24+
- "[cC][oO][pP][yY][rR][iI][gG][hH][tH]*"
25+
- "[lL][iI][cC][eE][nN][cCsS][eE]*"
26+
- "[oO][fF][lL]*"
27+
- "[pP][aA][tT][eE][nN][tT][sS]*"
28+
workflow_dispatch:
29+
repository_dispatch:
30+
31+
jobs:
32+
check-license:
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v2
38+
39+
- name: Install Ruby
40+
uses: ruby/setup-ruby@v1
41+
with:
42+
ruby-version: ruby # Install latest version
43+
44+
- name: Install licensee
45+
run: gem install licensee
46+
47+
- name: Check license file
48+
run: |
49+
EXIT_STATUS=0
50+
# See: https://github.com/licensee/licensee
51+
LICENSEE_OUTPUT="$(licensee detect --json --confidence=100)"
52+
53+
DETECTED_LICENSE_FILE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].filename | tr --delete '\r')"
54+
echo "Detected license file: $DETECTED_LICENSE_FILE"
55+
if [ "$DETECTED_LICENSE_FILE" != "\"${EXPECTED_LICENSE_FILENAME}\"" ]; then
56+
echo "::error file=${DETECTED_LICENSE_FILE}::detected license file $DETECTED_LICENSE_FILE doesn't match expected: $EXPECTED_LICENSE_FILENAME"
57+
EXIT_STATUS=1
58+
fi
59+
60+
DETECTED_LICENSE_TYPE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].matched_license | tr --delete '\r')"
61+
echo "Detected license type: $DETECTED_LICENSE_TYPE"
62+
if [ "$DETECTED_LICENSE_TYPE" != "\"${EXPECTED_LICENSE_TYPE}\"" ]; then
63+
echo "::error file=${DETECTED_LICENSE_FILE}::detected license type $DETECTED_LICENSE_TYPE doesn't match expected \"${EXPECTED_LICENSE_TYPE}\""
64+
EXIT_STATUS=1
65+
fi
66+
67+
exit $EXIT_STATUS

Diff for: LICENSE.txt

-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
This file includes licensing information for arduino-cli
2-
3-
Copyright (c) 2018 ARDUINO SA (www.arduino.cc)
4-
5-
The software is released under the GNU General Public License, which covers the main body
6-
of the arduino-cli code. The terms of this license can be found at:
7-
https://www.gnu.org/licenses/gpl-3.0.en.html
8-
9-
You can be released from the requirements of the above licenses by purchasing
10-
a commercial license. Buying such a license is mandatory if you want to modify or
11-
otherwise use the software for commercial activities involving the Arduino
12-
software without disclosing the source code of your own applications. To purchase
13-
a commercial license, send an email to license@arduino.cc
14-
151
GNU GENERAL PUBLIC LICENSE
162
Version 3, 29 June 2007
173

Diff for: README.md

+10
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ policy] and report the bug to our Security Team 🛡️ Thank you!
4545

4646
e-mail contact: security@arduino.cc
4747

48+
## License
49+
50+
Arduino CLI is licensed under the [GPL 3.0] license.
51+
52+
You can be released from the requirements of the above license by purchasing a commercial license. Buying such a license
53+
is mandatory if you want to modify or otherwise use the software for commercial activities involving the Arduino
54+
software without disclosing the source code of your own applications. To purchase a commercial license, send an email to
55+
license@arduino.cc
56+
4857
[install]: https://arduino.github.io/arduino-cli/latest/installation
4958
[user documentation]: https://arduino.github.io/arduino-cli/latest/
5059
[getting started]: https://arduino.github.io/arduino-cli/latest/getting-started/
@@ -54,3 +63,4 @@ e-mail contact: security@arduino.cc
5463
[contributors]: https://github.com/arduino/arduino-cli/graphs/contributors
5564
[nightly builds]: https://arduino.github.io/arduino-cli/latest/installation/#nightly-builds
5665
[security policy]: https://github.com/arduino/arduino-cli/security/policy
66+
[gpl 3.0]: https://www.gnu.org/licenses/gpl-3.0.en.html

0 commit comments

Comments
 (0)