|
17 | 17 | #/ |
18 | 18 |
|
19 | 19 | # Workflow name: |
20 | | -name: 'Lint Copyright Years in Newly Added Files' |
| 20 | +name: 'lint_copyright_years' |
21 | 21 |
|
22 | 22 | # Workflow triggers: |
23 | 23 | on: |
@@ -85,30 +85,34 @@ jobs: |
85 | 85 | echo "" >> $GITHUB_STEP_SUMMARY |
86 | 86 |
|
87 | 87 | 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 |
90 | 91 | fi |
91 | 92 |
|
92 | 93 | for file in $files; do |
93 | | - if [[ ! -f "$file" ]]; then |
94 | | - continue |
95 | | - fi |
| 94 | + if [[ ! -f "$file" ]]; then |
| 95 | + continue |
| 96 | + fi |
96 | 97 |
|
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") |
101 | 102 |
|
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 |
109 | 107 | 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 |
111 | 111 | fi |
| 112 | + else |
| 113 | + echo "⚠️ $file: No copyright notice found" |
| 114 | + echo "- ⚠️ No copyright notice found in \`$file\`" >> $GITHUB_STEP_SUMMARY |
| 115 | + fi |
112 | 116 | done |
113 | 117 |
|
114 | 118 | exit $exit_code |
0 commit comments