Skip to content

Commit f6fe0e8

Browse files
committed
ci: polish linelint job
1 parent 3eda516 commit f6fe0e8

File tree

1 file changed

+10
-31
lines changed

1 file changed

+10
-31
lines changed

โ€Ž.github/workflows/integration.yaml

+10-31
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,18 @@ jobs:
1111
with:
1212
fetch-depth: 0
1313

14-
- name: Get list of changed files
15-
id: changed-files
14+
- name: Find files missing end line break
1615
run: |
17-
changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | jq -R -s -c 'split("\n")[:-1]')
18-
echo "changed_files: $changed_files"
19-
echo "files=$changed_files" >> $GITHUB_OUTPUT
20-
21-
- name: Check for missing newlines
22-
id: newline-check
23-
run: |
24-
files_without_newline=()
25-
while IFS= read -r file; do
26-
if [ -f "$file" ]; then
27-
last_char=$(tail -c 1 "$file")
28-
if [ -n "$last_char" ]; then
29-
files_without_newline+=("$file")
30-
fi
16+
files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})
17+
success=true
18+
for file in $files; do
19+
if [ "$(tail -c 1 $file | wc -l)" -eq 0 ]; then
20+
echo "- $file" >> $GITHUB_STEP_SUMMARY
21+
success=false
3122
fi
32-
done < <(echo '${{ steps.changed-files.outputs.files }}' | jq -r '.[]')
23+
done
3324
34-
if [ ${#files_without_newline[@]} -gt 0 ]; then
35-
json_files=$(printf '%s\n' "${files_without_newline[@]}" | jq -R -s -c 'split("\n")[:-1]')
36-
echo "files_without_newline: $json_files"
37-
echo "files=$json_files" >> $GITHUB_OUTPUT
25+
if [ "$success" = false ]; then
26+
echo -e "\n:warning: ์œ„ ํŒŒ์ผ๋“ค์˜ ๋์— ๋ˆ„๋ฝ๋œ ์ค„ ๋ฐ”๊ฟˆ์„ ์ถ”๊ฐ€ํ•ด ์ฃผ์„ธ์š”." >> $GITHUB_STEP_SUMMARY
3827
exit 1
3928
fi
40-
41-
- name: Set Job Summary
42-
if: failure()
43-
run: |
44-
if [ -n '${{ steps.newline-check.outputs.files }}' ]; then
45-
echo "๐Ÿ› ๏ธ ์•„๋ž˜ ํŒŒ์ผ๋“ค์— ๊ณต๋ฐฑ ์ค„์„ ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”:" >> $GITHUB_STEP_SUMMARY
46-
echo '${{ steps.newline-check.outputs.files }}' |
47-
jq -r '.[]' |
48-
sed 's/^/- /' >> $GITHUB_STEP_SUMMARY
49-
fi

0 commit comments

Comments
ย (0)