Skip to content

Commit 9a48d25

Browse files
committed
Fix copyright checker
The have_err variable was unset after the loop as it ran in a subshell.
1 parent e0e41cd commit 9a48d25

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

.github/workflows/code-formatting.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,16 @@ jobs:
130130
// granted to it by virtue of its status as an Intergovernmental Organization
131131
// or submit itself to any jurisdiction.
132132
run: |
133-
set -exo pipefail
134133
# Run copyright notice check
135134
copyright_lines=$(echo "$COPYRIGHT" | wc -l)
136135
base_commit=$(git merge-base HEAD ${{ github.event.pull_request.base.sha }})
137136
have_err=
138-
git diff --diff-filter d --name-only "$base_commit" -- '*.cxx' '*.h' | while read -r file; do
137+
while read -r file; do
139138
if [ "$(head -n "$copyright_lines" "$file")" != "$COPYRIGHT" ]; then
140139
echo "::error::$file: missing or malformed copyright notice" >&2
141140
have_err=1
142141
fi
143-
done
142+
done < <(git diff --diff-filter d --name-only "$base_commit" -- '*.cxx' '*.h')
144143
145144
# Tell user what to do in case of copyright notice error
146145
if [ -n "$have_err" ]; then

0 commit comments

Comments
 (0)