From 145760fee264405dc7096250e76e5599322d5220 Mon Sep 17 00:00:00 2001 From: wambuipixel Date: Tue, 28 Jan 2025 10:39:57 +0300 Subject: [PATCH 1/3] add license check Signed-off-by: wambuipixel --- .github/workflows/check-license.yaml | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/check-license.yaml diff --git a/.github/workflows/check-license.yaml b/.github/workflows/check-license.yaml new file mode 100644 index 0000000..899f549 --- /dev/null +++ b/.github/workflows/check-license.yaml @@ -0,0 +1,40 @@ +# Copyright (c) Abstract Machines +# SPDX-License-Identifier: Apache-2.0 + +name: Check License Header + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + check-license: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Check License Header + run: | + CHECK="" + for file in $(grep -rl --exclude-dir={.git,build,.changeset} \ + --exclude=\*.{crt,key,pem,zed,hcl,md,json,csv,mod,sum,tmpl,args,eslintignore} \ + --exclude={CODEOWNERS,LICENSE,MAINTAINERS} \ + .); do + + if ! head -n 5 "$file" | grep -q "Copyright (c) Abstract Machines"; then + CHECK="$CHECK $file" + fi + done + + if [ "$CHECK" ]; then + echo "License header check failed. Fix the following files:" + echo "$CHECK" + exit 1 + else + echo "All files have the correct license header!" + fi From 1976613f240c01ae88e2a62d309d474121205d4e Mon Sep 17 00:00:00 2001 From: wambuipixel Date: Tue, 28 Jan 2025 13:30:30 +0300 Subject: [PATCH 2/3] add more files Signed-off-by: wambuipixel --- .github/workflows/check-license.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-license.yaml b/.github/workflows/check-license.yaml index 899f549..1a9bc1d 100644 --- a/.github/workflows/check-license.yaml +++ b/.github/workflows/check-license.yaml @@ -22,7 +22,7 @@ jobs: run: | CHECK="" for file in $(grep -rl --exclude-dir={.git,build,.changeset} \ - --exclude=\*.{crt,key,pem,zed,hcl,md,json,csv,mod,sum,tmpl,args,eslintignore} \ + --exclude=\*.{crt,key,pem,zed,hcl,md,json,csv,mod,sum,tmpl,args,eslintignore,prettierrc,bundle.js,prettierignore} \ --exclude={CODEOWNERS,LICENSE,MAINTAINERS} \ .); do From 7736c6c2763eb9afd78d8980a1f65a1cd1761b9a Mon Sep 17 00:00:00 2001 From: wambuipixel Date: Tue, 28 Jan 2025 13:45:40 +0300 Subject: [PATCH 3/3] remove unused file extensions Signed-off-by: wambuipixel --- .github/workflows/check-license.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-license.yaml b/.github/workflows/check-license.yaml index 1a9bc1d..21e2a34 100644 --- a/.github/workflows/check-license.yaml +++ b/.github/workflows/check-license.yaml @@ -22,8 +22,8 @@ jobs: run: | CHECK="" for file in $(grep -rl --exclude-dir={.git,build,.changeset} \ - --exclude=\*.{crt,key,pem,zed,hcl,md,json,csv,mod,sum,tmpl,args,eslintignore,prettierrc,bundle.js,prettierignore} \ - --exclude={CODEOWNERS,LICENSE,MAINTAINERS} \ + --exclude=\*.{md,json,eslintignore,prettierrc,prettierignore} \ + --exclude={bundle.js,LICENSE} \ .); do if ! head -n 5 "$file" | grep -q "Copyright (c) Abstract Machines"; then