google / addlicense

A program which ensures source code files have copyright license headers by scanning directory patterns recursively

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

provide fail-on-diff flag to enable checking licence headers

developer-guy opened this issue · comments

We (w/@Dentrax) thought that in scenarios such as checking license headers, we use addlicence tool like the following way:

  license-check:
    name: license boilerplate check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-go@v2
        with:
          go-version: '1.17.x'
      - name: Install addlicense
        run: go install github.com/google/addlicense@latest
      - name: Check license headers
        run: |
          set -e
          addlicense -l apache -c 'The Sigstore Authors' -v *
          git diff --exit-code

As you can see from the above GitHub Action definition, we use additional git commands to check that is there any leaked license headers in the codebase, so, what we are proposing is that we add this logic into addlicence tool with an additional flag-like --fail-on-diff.

would you mind assigning to us if you agree with this idea 🙋🏻‍♂️

Could you do this with the existing -check flag, which should return a non-zero status code if headers are missing ?

ah thank you, we missed that flag 🤦🏻‍♂️

It sounds like -check will work for you, so I'm going to go ahead and close this. Feel free to reopen if it turns out that doesn't work.