|
26 | 26 | - name: git log --check
|
27 | 27 | id: check_out
|
28 | 28 | run: |
|
29 |
| - baseSha=${{github.event.pull_request.base.sha}} |
30 |
| - problems=() |
31 |
| - commit= |
32 |
| - commitText= |
33 |
| - commitTextmd= |
34 |
| - goodParent= |
35 |
| - while read dash sha etc |
36 |
| - do |
37 |
| - case "${dash}" in |
38 |
| - "---") # Line contains commit information. |
39 |
| - if test -z "${goodParent}" |
40 |
| - then |
41 |
| - # Assume the commit has no whitespace errors until detected otherwise. |
42 |
| - goodParent=${sha} |
43 |
| - fi |
44 |
| - commit="${sha}" |
45 |
| - commitText="${sha} ${etc}" |
46 |
| - commitTextmd="[${sha}](https://github.com/${{ github.repository }}/commit/${sha}) ${etc}" |
47 |
| - ;; |
48 |
| - "") |
49 |
| - ;; |
50 |
| - *) # Line contains whitespace error information for current commit. |
51 |
| - if test -n "${goodParent}" |
52 |
| - then |
53 |
| - problems+=("1) --- ${commitTextmd}") |
54 |
| - echo "" |
55 |
| - echo "--- ${commitText}" |
56 |
| - goodParent= |
57 |
| - fi |
58 |
| - case "${dash}" in |
59 |
| - *:[1-9]*:) # contains file and line number information |
60 |
| - dashend=${dash#*:} |
61 |
| - problems+=("[${dash}](https://github.com/${{ github.repository }}/blob/${commit}/${dash%%:*}#L${dashend%:}) ${sha} ${etc}") |
62 |
| - ;; |
63 |
| - *) |
64 |
| - problems+=("\`${dash} ${sha} ${etc}\`") |
65 |
| - ;; |
66 |
| - esac |
67 |
| - echo "${dash} ${sha} ${etc}" |
68 |
| - ;; |
69 |
| - esac |
70 |
| - done <<< $(git log --check --pretty=format:"---% h% s" ${baseSha}..) |
71 |
| -
|
72 |
| - if test ${#problems[*]} -gt 0 |
73 |
| - then |
74 |
| - if test -z "${goodParent}" |
75 |
| - then |
76 |
| - goodParent=${baseSha: 0:7} |
77 |
| - fi |
78 |
| - echo "🛑 Please review the Summary output for further information." |
79 |
| - echo "### :x: A whitespace issue was found in one or more of the commits." >$GITHUB_STEP_SUMMARY |
80 |
| - echo "" >>$GITHUB_STEP_SUMMARY |
81 |
| - echo "Run these commands to correct the problem:" >>$GITHUB_STEP_SUMMARY |
82 |
| - echo "1. \`git rebase --whitespace=fix ${goodParent}\`" >>$GITHUB_STEP_SUMMARY |
83 |
| - echo "1. \`git push --force\`" >>$GITHUB_STEP_SUMMARY |
84 |
| - echo " " >>$GITHUB_STEP_SUMMARY |
85 |
| - echo "Errors:" >>$GITHUB_STEP_SUMMARY |
86 |
| - for i in "${problems[@]}" |
87 |
| - do |
88 |
| - echo "${i}" >>$GITHUB_STEP_SUMMARY |
89 |
| - done |
90 |
| -
|
91 |
| - exit 2 |
92 |
| - fi |
| 29 | + ./ci/check-whitespace.sh \ |
| 30 | + "${{github.event.pull_request.base.sha}}" \ |
| 31 | + "$GITHUB_STEP_SUMMARY" \ |
| 32 | + "https://github.com/${{github.repository}}" |
0 commit comments