From 8103f82dff4cdc3d3565a87fbf28115a3f3c7844 Mon Sep 17 00:00:00 2001 From: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Date: Tue, 14 Nov 2023 14:20:53 +0300 Subject: [PATCH] fix(ci): log failed files When the CI fails during check for license header, log the failed file to console so that someone can check on the actual file. Also simplify the grep check to make it more human readable and understandable Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> --- .github/workflows/check-license.yaml | 16 +++++++--------- auth/api/http/domains/decode.go | 2 +- auth/api/http/domains/endpoint.go | 2 +- auth/api/http/domains/requests.go | 2 +- auth/api/http/domains/responses.go | 2 +- auth/api/http/domains/transport.go | 2 +- auth/domains.go | 2 +- auth/mocks/domains.go | 2 +- auth/postgres/domains.go | 2 +- auth/postgres/domains_test.go | 3 +++ pkg/auth/client.go | 2 +- pkg/auth/doc.go | 2 +- 12 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/workflows/check-license.yaml b/.github/workflows/check-license.yaml index 07359149c..fea361d25 100644 --- a/.github/workflows/check-license.yaml +++ b/.github/workflows/check-license.yaml @@ -20,14 +20,12 @@ jobs: - name: Check License Header run: | - if [ "$(grep -rcL --exclude-dir=.git --exclude-dir=build \ - --exclude=\*.crt --exclude=\*.key --exclude=\*.pem \ - --exclude=\*.zed --exclude=\*.hcl \ - --exclude=CODEOWNERS --exclude=LICENSE --exclude=MAINTAINERS \ - --exclude=\*.md --exclude=\*.json --exclude=\*.csv \ - --exclude=\*.mod --exclude=\*.sum \ - --exclude=\*.tmpl --exclude=\*.args \ - --regexp "Copyright (c) Abstract Machines" .)" ]; then - echo "License header check failed" + CHECK=$(grep -rcL --exclude-dir={.git,build} \ + --exclude=\*.{crt,key,pem,zed,hcl,md,json,csv,mod,sum,tmpl,args} \ + --exclude={CODEOWNERS,LICENSE,MAINTAINERS} \ + --regexp "Copyright (c) Abstract Machines" .) + if [ "$CHECK" ]; then + echo "License header check failed. Fix the following files:" + echo "$CHECK" exit 1 fi diff --git a/auth/api/http/domains/decode.go b/auth/api/http/domains/decode.go index c55e1fab9..9ca8d7ce2 100644 --- a/auth/api/http/domains/decode.go +++ b/auth/api/http/domains/decode.go @@ -1,4 +1,4 @@ -// Copyright (c) Magistrala +// Copyright (c) Abstract Machines // SPDX-License-Identifier: Apache-2.0 package domains diff --git a/auth/api/http/domains/endpoint.go b/auth/api/http/domains/endpoint.go index ee94bd837..7a408c05c 100644 --- a/auth/api/http/domains/endpoint.go +++ b/auth/api/http/domains/endpoint.go @@ -1,4 +1,4 @@ -// Copyright (c) Magistrala +// Copyright (c) Abstract Machines // SPDX-License-Identifier: Apache-2.0 package domains diff --git a/auth/api/http/domains/requests.go b/auth/api/http/domains/requests.go index 626a5e661..02d4cf7dc 100644 --- a/auth/api/http/domains/requests.go +++ b/auth/api/http/domains/requests.go @@ -1,4 +1,4 @@ -// Copyright (c) Magistrala +// Copyright (c) Abstract Machines // SPDX-License-Identifier: Apache-2.0 package domains diff --git a/auth/api/http/domains/responses.go b/auth/api/http/domains/responses.go index 1d7ecc99c..6342f8ca6 100644 --- a/auth/api/http/domains/responses.go +++ b/auth/api/http/domains/responses.go @@ -1,4 +1,4 @@ -// Copyright (c) Magistrala +// Copyright (c) Abstract Machines // SPDX-License-Identifier: Apache-2.0 package domains diff --git a/auth/api/http/domains/transport.go b/auth/api/http/domains/transport.go index a0a6c24ac..c3f70412f 100644 --- a/auth/api/http/domains/transport.go +++ b/auth/api/http/domains/transport.go @@ -1,4 +1,4 @@ -// Copyright (c) Magistrala +// Copyright (c) Abstract Machines // SPDX-License-Identifier: Apache-2.0 package domains diff --git a/auth/domains.go b/auth/domains.go index 8a1b589da..b391c4127 100644 --- a/auth/domains.go +++ b/auth/domains.go @@ -1,4 +1,4 @@ -// Copyright (c) Magistrala +// Copyright (c) Abstract Machines // SPDX-License-Identifier: Apache-2.0 package auth diff --git a/auth/mocks/domains.go b/auth/mocks/domains.go index 5dd4a98ba..7969c26a0 100644 --- a/auth/mocks/domains.go +++ b/auth/mocks/domains.go @@ -1,4 +1,4 @@ -// Copyright (c) Magistrala +// Copyright (c) Abstract Machines // SPDX-License-Identifier: Apache-2.0 package mocks diff --git a/auth/postgres/domains.go b/auth/postgres/domains.go index 086c06679..96a63d558 100644 --- a/auth/postgres/domains.go +++ b/auth/postgres/domains.go @@ -1,4 +1,4 @@ -// Copyright (c) Magistrala +// Copyright (c) Abstract Machines // SPDX-License-Identifier: Apache-2.0 package postgres diff --git a/auth/postgres/domains_test.go b/auth/postgres/domains_test.go index 52ecf9a59..32c2a69b8 100644 --- a/auth/postgres/domains_test.go +++ b/auth/postgres/domains_test.go @@ -1,3 +1,6 @@ +// Copyright (c) Abstract Machines +// SPDX-License-Identifier: Apache-2.0 + package postgres_test import ( diff --git a/pkg/auth/client.go b/pkg/auth/client.go index 47cdb1862..9d268fd03 100644 --- a/pkg/auth/client.go +++ b/pkg/auth/client.go @@ -1,4 +1,4 @@ -// Copyright (c) Magistrala +// Copyright (c) Abstract Machines // SPDX-License-Identifier: Apache-2.0 package auth diff --git a/pkg/auth/doc.go b/pkg/auth/doc.go index e1229a7d0..ba8d89192 100644 --- a/pkg/auth/doc.go +++ b/pkg/auth/doc.go @@ -1,4 +1,4 @@ -// Copyright (c) Magistrala +// Copyright (c) Abstract Machines // SPDX-License-Identifier: Apache-2.0 // Package auth contains the domain concept definitions needed to support