Skip to content

GitHub Action for RAT check #6

GitHub Action for RAT check

GitHub Action for RAT check #6

Workflow file for this run

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