Skip to content

GitHub Action for RAT check #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/rat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: RAT Check

on:
push:
branches:
- main
pull_request:
branches:
- '**'

jobs:
rat:
name: Apache RAT Check
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17

- name: Download Apache RAT
run: |
curl -L -O https://downloads.apache.org/creadur/apache-rat-0.16.1/apache-rat-0.16.1-bin.tar.gz
tar -xzf apache-rat-0.16.1-bin.tar.gz

- name: Create exception list
run: |
echo ./exception.lst >exception.lst
echo ./CHANGES.md >>exception.lst
echo ./go.sum >>exception.lst
echo ./rat-report.txt >>exception.lst
echo ./apache-rat-0.16.1/* >>exception.lst
echo ./snap/snapcraft.yaml >>exception.lst
echo ./vedor/* >>exception.lst

- name: Run RAT
run: |
java -jar apache-rat-0.16.1/apache-rat-0.16.1.jar -d . -E exception.lst > rat-report.txt
cat rat-report.txt
# Fail if unapproved licenses are found
grep -q 'Unknown Licenses' rat-report.txt && exit 1 || exit 0
Loading