Skip to content

Commit 009becd

Browse files
committed
build: update name, indentation, and also print to terminal
1 parent 7e05335 commit 009becd

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

.github/workflows/lint_copyright_years.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#/
1818

1919
# Workflow name:
20-
name: 'Lint Copyright Years in Newly Added Files'
20+
name: 'lint_copyright_years'
2121

2222
# Workflow triggers:
2323
on:
@@ -85,30 +85,34 @@ jobs:
8585
echo "" >> $GITHUB_STEP_SUMMARY
8686
8787
if [[ -z "$files" ]]; then
88-
echo "No newly added files to check." >> $GITHUB_STEP_SUMMARY
89-
exit 0
88+
echo "No newly added files to check."
89+
echo "No newly added files to check." >> $GITHUB_STEP_SUMMARY
90+
exit 0
9091
fi
9192
9293
for file in $files; do
93-
if [[ ! -f "$file" ]]; then
94-
continue
95-
fi
94+
if [[ ! -f "$file" ]]; then
95+
continue
96+
fi
9697
97-
# Check if file contains stdlib copyright notice:
98-
year=$(grep -oP \
99-
'Copyright \(c\) \K[0-9]{4}(?= The Stdlib Authors\.)' \
100-
"$file")
98+
# Check if file contains stdlib copyright notice:
99+
year=$(grep -oP \
100+
'Copyright \(c\) \K[0-9]{4}(?= The Stdlib Authors\.)' \
101+
"$file")
101102
102-
if [[ -n "$year" ]]; then
103-
if [[ "$year" == "$current_year" ]]; then
104-
echo "- ✅ \`$file\`: Year is correct (**$year**)" >> $GITHUB_STEP_SUMMARY
105-
else
106-
echo "- ❌ **Error**: \`$file\` — Expected year **$current_year**, found **$year**" >> $GITHUB_STEP_SUMMARY
107-
exit_code=1
108-
fi
103+
if [[ -n "$year" ]]; then
104+
if [[ "$year" == "$current_year" ]]; then
105+
echo "✅ $file: Correct year $year"
106+
echo "- ✅ \`$file\`: Year is correct (**$year**)" >> $GITHUB_STEP_SUMMARY
109107
else
110-
echo "- ⚠️ No copyright notice found in \`$file\`" >> $GITHUB_STEP_SUMMARY
108+
echo "❌ $file: Expected $current_year, found $year"
109+
echo "- ❌ **Error**: \`$file\` — Expected year **$current_year**, found **$year**" >> $GITHUB_STEP_SUMMARY
110+
exit_code=1
111111
fi
112+
else
113+
echo "⚠️ $file: No copyright notice found"
114+
echo "- ⚠️ No copyright notice found in \`$file\`" >> $GITHUB_STEP_SUMMARY
115+
fi
112116
done
113117
114118
exit $exit_code

0 commit comments

Comments
 (0)