Skip to content

Commit

Permalink
Switch to REUSE.toml, restrict PR license check to modified files
Browse files Browse the repository at this point in the history
  • Loading branch information
ajtribick committed Dec 13, 2024
1 parent 87d8ddb commit 4e4f11a
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 27 deletions.
36 changes: 35 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,41 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v4

- name: Validate licenses
- name: Validate licenses (pull request)
if: github.event_name == 'pull_request'
working-directory: ${{github.workspace}}
run: |
baseSha='${{ github.event.pull_request.base.sha }}'
git fetch origin --depth=1 $baseSha
quick_check=0
# check if there are no changes to REUSE.toml
if git diff --exit-code -s $baseSha HEAD -- REUSE.toml ; then
# check if there are no deletions from LICENSES
if git diff --exit-code -s --diff-filter=D $baseSha HEAD -- LICENSES ; then
echo "Performing quick check"
quick_check=1
else
echo "Found deleted license - performing full check"
fi
else
echo "REUSE.toml changed - performing full check"
fi
if [ "$quick_check" -eq 1 ] ; then
# normal PR - check modified files only
git diff --name-only $baseSha HEAD \
| sed -E 's/\.license$//' \
| sort -u \
| xargs -d '\n' ls -1d 2>/dev/null \
| xargs -d '\n' python3 -m pipx run reuse lint-file --
else
# we changed REUSE.toml or deleted a license - check everything
python3 -m pipx run reuse lint
fi
- name: Validate licenses (push)
if: github.event_name == 'push'
working-directory: ${{github.workspace}}
run: |
python3 -m pipx run reuse lint
Expand Down
26 changes: 0 additions & 26 deletions .reuse/dep5

This file was deleted.

22 changes: 22 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version = 1
SPDX-PackageName = "Celestia Content"
SPDX-PackageSupplier = "Celestia Development Team"
SPDX-PackageDownloadLocation = "https://github.com/CelestiaProject/CelestiaContent"

[[annotations]]
path = "README"
precedence = "aggregate"
SPDX-FileCopyrightText = "Celestia Development Team"
SPDX-License-Identifier = "GPL-2.0-or-later"

[[annotations]]
path = ".github/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "Celestia Development Team"
SPDX-License-Identifier = "GPL-2.0-or-later"

[[annotations]]
path = "debian/**"
precedence = "aggregate"
SPDX-FileCopyrightText = ["2001-2002 Marcelo E. Magallon <[email protected]>", "2003 Mika Fischer <[email protected]>", "2005 Mathias Weyland <[email protected]>", "2007-2013 Guus Sliepen <[email protected]>", "2019 Celestia Development Team"]
SPDX-License-Identifier = "GPL-2.0-or-later"

0 comments on commit 4e4f11a

Please sign in to comment.