Skip to content

Commit

Permalink
Add license auto-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollonval committed Nov 27, 2024
1 parent ae8c5f0 commit c41f9d9
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/fix-license-header.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Fix License Headers

on:
pull_request_target:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
header-license-fix:
runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout the branch from the PR that triggered the job
run: gh pr checkout ${{ github.event.pull_request.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Fix License Header
# pin to include https://github.com/apache/skywalking-eyes/pull/168
uses: apache/skywalking-eyes/header@e19b828cea6a6027cceae78f05d81317347d21be
with:
mode: fix

- name: List files changed
id: files-changed
shell: bash -l {0}
run: |
set -ex
export CHANGES=$(git status --porcelain | tee /tmp/modified.log | wc -l)
cat /tmp/modified.log
echo "N_CHANGES=${CHANGES}" >> $GITHUB_OUTPUT
git diff
- name: Commit any changes
if: steps.files-changed.outputs.N_CHANGES != '0'
shell: bash -l {0}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git pull --no-tags
git add *
git commit -m "Automatic application of license header"
git config push.default upstream
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
header:
license:
spdx-id: BSD-3-Clause
copyright-owner: Datalayer, Inc.
copyright-year: 2023-2024
software-name: jupyter-kernel-client

paths-ignore:
- '**/*.ipynb'
- '**/*.json'
- '**/*.yaml'
- '**/*.yml'
- '**/.*'
- 'LICENSE'

comment: on-failure
4 changes: 4 additions & 0 deletions jupyter_kernel_client/log.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright (c) 2023-2024 Datalayer, Inc.
#
# BSD 3-Clause License

"""Grab the global logger instance.
This is a slight modification of traitlets code licensed under BSD 3-Clause License
Expand Down
4 changes: 4 additions & 0 deletions jupyter_kernel_client/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# Copyright (c) 2023-2024 Datalayer, Inc.
#
# BSD 3-Clause License

"""Python unit tests for jupyter_kernel_client."""
4 changes: 4 additions & 0 deletions jupyter_kernel_client/tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright (c) 2023-2024 Datalayer, Inc.
#
# BSD 3-Clause License

async def test_get(jp_fetch):
await jp_fetch("jupyter-kernel-client/ping")

Expand Down

0 comments on commit c41f9d9

Please sign in to comment.