Skip to content

Commit 1cb07c8

Browse files
authored
Add license to files automatically (#147)
* Add license to files automatically * Lint file
1 parent 08df151 commit 1cb07c8

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

.github/workflows/license-header.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Fix License Headers
2+
3+
on:
4+
pull_request_target:
5+
6+
jobs:
7+
header-license-fix:
8+
runs-on: ubuntu-latest
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
with:
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- name: Configure git to use https
21+
run: git config --global hub.protocol https
22+
23+
- name: Checkout the branch from the PR that triggered the job
24+
run: hub pr checkout ${{ github.event.pull_request.number }}
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Fix License Header
29+
uses: apache/skywalking-eyes/[email protected]
30+
with:
31+
mode: fix
32+
33+
- name: List files changed
34+
id: files-changed
35+
shell: bash -l {0}
36+
run: |
37+
set -ex
38+
export CHANGES=$(git status --porcelain | tee modified.log | wc -l)
39+
cat modified.log
40+
# Remove the log otherwise it will be committed
41+
rm modified.log
42+
43+
echo "N_CHANGES=${CHANGES}" >> $GITHUB_OUTPUT
44+
45+
git diff
46+
47+
- name: Commit any changes
48+
if: steps.files-changed.outputs.N_CHANGES != '0'
49+
shell: bash -l {0}
50+
run: |
51+
git config user.name "github-actions[bot]"
52+
git config user.email "github-actions[bot]@users.noreply.github.com"
53+
54+
git pull --no-tags
55+
56+
git add *
57+
git commit -m "Automatic application of license header"
58+
59+
git config push.default upstream
60+
git push
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.licenserc.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
header:
2+
license:
3+
spdx-id: BSD-3-Clause
4+
copyright-owner: Jupyter Development Team
5+
software-name: JupyterLab
6+
content: |
7+
Copyright (c) Jupyter Development Team.
8+
Distributed under the terms of the Modified BSD License.
9+
10+
paths-ignore:
11+
- '**/*.ipynb'
12+
- '**/*.json'
13+
- '**/*.md'
14+
- '**/*.svg'
15+
- '**/*.yml'
16+
- '**/*.yaml'
17+
- '**/build'
18+
- '**/lib'
19+
- '**/node_modules'
20+
- '*.map.js'
21+
- '*.bundle.js'
22+
- '**/.*'
23+
- 'binder/postBuild'
24+
- 'coverage'
25+
- 'LICENSE'
26+
- 'yarn.lock'
27+
28+
comment: on-failure

0 commit comments

Comments
 (0)