mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-22 12:30:08 +00:00
check current copyright year in modified files (#4868)
On PR, ensure current year is listed in copyright of modified files. Runs on Linux GitHub.
This commit is contained in:
parent
964417d8ba
commit
351f043a61
32
.github/workflows/ci.yml
vendored
32
.github/workflows/ci.yml
vendored
@ -1,3 +1,10 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2020-2023 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
@ -54,6 +61,31 @@ jobs:
|
||||
# with:
|
||||
# submodules: true
|
||||
|
||||
- name: Check copyright year (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
excluded_extensions="md|png"
|
||||
|
||||
base_branch=$(jq -r '.pull_request.base.ref' "$GITHUB_EVENT_PATH")
|
||||
git fetch origin "$base_branch" 2>/dev/null
|
||||
modified_files=$(git diff --name-only --diff-filter=d "origin/$base_branch" HEAD | grep -vE '\.('$excluded_extensions')$')
|
||||
|
||||
current_year=$(date +"%Y")
|
||||
outdated_files=()
|
||||
for file in $modified_files; do
|
||||
if ! grep -qE "Copyright \(c\) .*$current_year Status Research & Development GmbH" "$file"; then
|
||||
outdated_files+=("$file")
|
||||
fi
|
||||
done
|
||||
|
||||
if (( ${#outdated_files[@]} )); then
|
||||
echo "The following files do not have an up-to-date copyright year:"
|
||||
for file in "${outdated_files[@]}"; do
|
||||
echo "- $file"
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: MSYS2 (Windows amd64)
|
||||
if: runner.os == 'Windows' && matrix.target.cpu == 'amd64'
|
||||
uses: msys2/setup-msys2@v2
|
||||
|
Loading…
x
Reference in New Issue
Block a user