From c2011c693d60e2bdc065aee64a281dc1cf357881 Mon Sep 17 00:00:00 2001 From: Rafal Stefanowski Date: Wed, 11 May 2022 15:01:00 +0200 Subject: [PATCH] copyright/license: Improve checking for copyright header Besides looking for files with proper extension, check also listed files without extension, which should contain this header as well. Signed-off-by: Rafal Stefanowski --- .github/workflows/pullrequest.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index a34c554..685197b 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -3,9 +3,10 @@ on: pull_request: branches: - master - + env: - EXTENSIONS: "c h cpp py go sh" + EXTENSIONS: "c h cpp py go sh mk spec service" + FILES: "configure configure.d/* *Makefile utils/casctl tools/pckgen.d/deb/debian/rules" jobs: verify-date: runs-on: ubuntu-latest @@ -23,15 +24,16 @@ jobs: files_to_check=(${{ steps.changed-files.outputs.added_files }}) files_to_check+=(${{ steps.changed-files.outputs.modified_files }}) - for FILE in ${files_to_check[@]}; do - REGEX=".*\.(.*)" - if [[ "$FILE" =~ $REGEX ]] - then - EXTENSION=${BASH_REMATCH[1]} - EXTENSIONS_LIST=($EXTENSIONS) - if [[ " ${EXTENSIONS_LIST[*]} " =~ " ${EXTENSION} " ]] - then - .github/verify_header.sh $FILE - fi + for file in ${files_to_check[@]}; do + for file_in_list in $FILES; do + if [[ "$file" == $file_in_list ]]; then + .github/verify_header.sh "$file" + continue 2 + fi + done + + extension=${file##*.} + if [[ "$EXTENSIONS" =~ $extension ]]; then + .github/verify_header.sh "$file" fi done