Skip to content

Commit

Permalink
Add workflow to check we have copyright headers with SPDX
Browse files Browse the repository at this point in the history
  • Loading branch information
agarciadom committed Oct 20, 2024
1 parent b632559 commit e1ff082
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions:
contents: read

jobs:
tycho-build:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/check-copyright-headers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Check copyright headers

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
check-licenses:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Check headers
run: ./check-copyright-headers.sh
13 changes: 13 additions & 0 deletions check-license-headers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

FIND=find
if which gfind >/dev/null; then
FIND=gfind
fi

$FIND -name '*.java' | (while read f; do
if ! fgrep -q "SPDX-License-Identifier" "$f"; then
echo "File $f does not have a license header"
exit 1
fi
done)

0 comments on commit e1ff082

Please sign in to comment.