|
30 | 30 | with: |
31 | 31 | fetch-depth: 0 |
32 | 32 |
|
| 33 | + # https://github.com/wagoid/commitlint-github-action/issues/560#issuecomment-1277659864 |
| 34 | + - run: rm tsconfig.json |
| 35 | + |
33 | 36 | - uses: wagoid/commitlint-github-action@v5 |
34 | 37 | id: commitlint |
35 | 38 | continue-on-error: true |
|
58 | 61 | script: | |
59 | 62 | const results = ${{ steps.commitlint.outputs.results }}; |
60 | 63 | const titleGood = ${{ steps.prTitle.outputs.success }}; |
61 | | -
|
62 | | - const totalErrors = results.reduce((a, r) => a + r.errors.length, 0); |
63 | | - const totalWarnings = results.reduce((a, r) => a + r.warnings.length, 0); |
64 | | -
|
65 | | - const header = ` |
66 | | - ## 👕 Commitlint Problems for this PR: ${!titleGood ? '' : ` |
67 | | -
|
68 | | - **The PR title conforms to conventional commit style** |
69 | | -
|
70 | | - 👉 **Make sure the PR is squashed into a single commit using the PR title** 👈`} |
71 | | -
|
72 | | - 🔎 found ${totalErrors} errors, ${totalWarnings} warnings |
73 | | - ℹ️ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint |
74 | | - `; |
75 | | -
|
76 | | - const comment = results.reduce((acc, result) => { |
77 | | - if (!result.errors.length && !result.warnings.length) { |
78 | | - return acc; |
79 | | - } |
80 | | -
|
81 | | - const [firstLine, ...rest] = result.message.split('\n'); |
82 | | -
|
83 | | - const body = rest.join('\n').trim(); |
84 | | - const icon = result.errors.length ? '❌' : '⚠️'; |
85 | | - const hash = result.hash.substring(0, 8); |
86 | | -
|
87 | | - return `${acc} ${!body.length ? '\n\n' : ` |
88 | | -
|
89 | | - <details><summary>`} |
90 | | - ${hash} - ${firstLine} ${!body.length ? '\n\n' : `\ |
91 | | - </summary> |
92 | | -
|
93 | | - ${body} |
94 | | -
|
95 | | - </details> |
96 | | -
|
97 | | - `}${result.errors.map(error => ` |
98 | | - - ❌ ${error}`).join('')} ${result.warnings.map(warn => ` |
99 | | - - ⚠️ ${warn}`).join('')}`; |
100 | | - }, header); |
101 | | -
|
102 | | - core.setOutput('comment', comment); |
| 64 | + const { format } = await import('${{ github.workspace }}/scripts/format-commitlint-messages.js'); |
| 65 | + return format({ core, results, titleGood }); |
103 | 66 |
|
104 | 67 | - name: Notify PR |
105 | 68 | if: ${{ steps.commitlint.outcome == 'failure' && steps.prTitle.outputs.success == 'false' }} |
|
109 | 72 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
110 | 73 | header: commitlint |
111 | 74 | message: | |
112 | | - ${{ steps.format.outputs.comment }} |
| 75 | + ${{ steps.format.outputs.result }} |
113 | 76 |
|
114 | 77 | - name: Fail Job on Error |
115 | 78 | if: ${{ steps.commitlint.outcome == 'failure' && steps.prTitle.outputs.success == 'false' }} |
|
0 commit comments