From fe46b973d4dec06ae156a0602c93a78943182be8 Mon Sep 17 00:00:00 2001 From: Andre Sailer Date: Wed, 26 Jul 2023 10:36:45 +0200 Subject: [PATCH] CI: add license pre-commit hook --- .github/templates/apache-2.tmpl | 16 ++++++++++++++++ .pre-commit-config.yaml | 11 +++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .github/templates/apache-2.tmpl diff --git a/.github/templates/apache-2.tmpl b/.github/templates/apache-2.tmpl new file mode 100644 index 00000000..f5299360 --- /dev/null +++ b/.github/templates/apache-2.tmpl @@ -0,0 +1,16 @@ +Copyright (c) ${years} ${owner}. + +This file is part of ${projectname}. +See ${projecturl} for further info. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f9148355..35347801 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,3 +12,14 @@ repos: entry: .github/scripts/clang-format-hook types: [c++] language: system + - repo: https://github.com/johann-petrak/licenseheaders.git + rev: 'v0.8.8' + hooks: + - id: licenseheaders + args: ["-t", ".github/templates/apache-2.tmpl", "-y2014-2023", + "-o", "Key4hep-Project", + "-n", "Key4hep", + "-u", "https://key4hep.github.io/key4hep-doc/", + "-x", ".github/*", ".pre-commit-config.yaml", "README.md", + "doc/ReleaseNotes.md", ".k4fwcore-ci.d/*", "init.sh", + "-f"]