Skip to content

Commit

Permalink
chore: workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bennypowers committed Aug 16, 2024
1 parent 5740769 commit 31ec619
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,32 @@ jobs:
- run: npm ci --prefer-offline
- run: npm i @commitlint/load

- id: commitlint
- id: prlint
uses: kevintyj/prlint@v2

- id: format
uses: actions/github-script@v6
env:
LINT_STATUS: ${{ steps.commitlint.outputs.lint-status }}
LINT_DETAILS: ${{ steps.commitlint.outputs.lint-details }}
with:
script: return `## ${process.env.LINT_STATUS}\n\n${process.env.LINT_DETAILS}`;

- id: comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: commitlint
message: |
${{ steps.format.outputs.result }}
## ${{ steps.prlint.outputs.lint-status }}
<details><summary>More Info</summary>
```json
${{ toJSON(fromJSON(steps.prlint.outputs.lint-details)) }}
```
</details>
- uses: actions/github-script@v7
env:
LINT_STATUS: ${{ steps.commitlint.outputs.lint-status }}
PR_TITLE_VALID: ${{ fromJSON(steps.prlint.outputs.lint-details).valid }}
PR_LINT_STATUS: ${{ steps.prlint.outputs.lint-status }}
with:
script: |
if (process.env.LINT_STATUS.startsWith('❌'))
core.setFailed(process.env.LINT_STATUS)
const { PR_LINT_STATUS, PR_TITLE_VALID } = process.env;
if (PR_TITLE_VALID.toString() !== 'true')
core.setFailed(PR_LINT_STATUS);

0 comments on commit 31ec619

Please sign in to comment.