1+ # Copyright 2024 Google LLC
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+ ---
16+ name : addlicense
17+
18+ on : # yamllint disable-line rule:truthy
19+ pull_request : null
20+
21+ permissions :
22+ contents : read
23+
24+ jobs :
25+ addlicense :
26+ permissions :
27+ contents : write
28+ runs-on : ubuntu-latest
29+ steps :
30+ - uses : actions/checkout@v4
31+ with :
32+ fetch-depth : 0
33+
34+ - name : Pull container for addlicense
35+ run : docker pull ghcr.io/google/addlicense:latest
36+
37+ - name : invoke addlicense
38+ run : docker run -v "${PWD}":/src ghcr.io/google/addlicense -l "apache" -c "Google LLC" .
39+
40+ - name : Commit and push license fixes
41+ # Run only on:
42+ # - Pull requests
43+ # - Not on the default branch
44+ if : >
45+ github.event_name == 'pull_request' &&
46+ github.ref_name != github.event.repository.default_branch
47+ uses : stefanzweifel/git-auto-commit-action@v5
48+ env :
49+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
50+ with :
51+ branch : ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
52+ commit_message : " chore: add license headers"
53+ commit_user_name : addlicense
54+ commit_user_email : no-reply@addlicense.dev
0 commit comments