A GitHub Action that validates source code files contain proper license and copyright headers.
This composite action scans the repository for source code files and verifies that each file contains either a "Copyright" statement or "Apache License" reference in its header. This helps ensure compliance with open-source licensing requirements.
- name: Check License Headers uses: ./.github/actions/license-check-action
name: License Compliance on: pull_request: push: branches: - main jobs: license-check: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Run license check uses: ./.github/actions/license-check-action
The action performs the following steps:
.git directory)The following file types and patterns are automatically excluded from license checking:
.png, .jpg, .gif, .ico, .svg, .PNG.eot, .ttf, .woff.pdf, .docx, .graffle.tar, .tar.gz, .jar, .oar, .csar.json, .jsonld, .JSON.xml, .yaml, .yml, .toml.properties, .conf, .cfg, .cnf, .config.csv, .db, .log.txt, .md, .rst.pem, .crt, .cert, .key, .csr, .der.jks, .p12, .asc, .gpg.pb.go, .pb.gw.go, *_pb2.py, *_pb2_grpc.py.pb.h, .pb.cc.pyc, .bingo.mod, go.sum.lock filesDockerfile, Dockerfile.*Makefile, Makefile.*README*ignore files (e.g., .gitignore, .dockerignore)*rc files (e.g., .bashrc, .npmrc)vendor/conf/git/swagger/docs/If files are incorrectly flagged as missing license headers: