build(deps-dev): Bump the dev group with 2 updates #2231
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# validate either actual commits or pr title | |
# src: https://raw.githubusercontent.com/patternfly/patternfly-elements/24dd236afbbc90045165fd33ddaf036e56e26cd7/.github/workflows/commitlint.yml | |
name: commitlint | |
on: | |
pull_request: | |
types: | |
- opened | |
- edited | |
- labeled | |
- auto_merge_enabled | |
- synchronize | |
- reopened | |
- ready_for_review | |
pull_request_review: | |
types: | |
- submitted | |
permissions: | |
contents: read | |
pull-requests: read | |
jobs: | |
pr-title: | |
runs-on: ubuntu-latest | |
if: github.actor != 'dependabot[bot]' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: wagoid/commitlint-github-action@v6 | |
id: commitlint | |
continue-on-error: true | |
with: | |
configFile: .commitlint.config.mjs | |
- name: Validate PR Title | |
id: prTitle | |
if: ${{ steps.commitlint.outcome == 'failure' }} | |
uses: aslafy-z/conventional-pr-title-action@v3.2.0 | |
continue-on-error: true | |
with: | |
success-state: Title follows the conventional commit format. | |
failure-state: Please update the title to use conventional commit format. | |
context-name: conventional-pr-title | |
preset: '@commitlint/config-conventional@latest' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Format Commitlint Messages | |
id: format | |
if: ${{ steps.commitlint.outcome == 'failure' }} | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const results = ${{ steps.commitlint.outputs.results }}; | |
const titleGood = ${{ steps.prTitle.outcome == 'success' }}; | |
const totalErrors = results.reduce((a, r) => a + r.errors.length, 0); | |
const totalWarnings = results.reduce((a, r) => a + r.warnings.length, 0); | |
const header = ` | |
## ?? Commitlint Problems for this PR: ${!titleGood ? '' : ` | |
**The PR title conforms to conventional commit style** | |
?? **Make sure the PR is squashed into a single commit using the PR title** ??`} | |
?? Found ${totalErrors} errors, ${totalWarnings} warnings | |
?? Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint | |
`; | |
const comment = results.reduce((acc, result) => { | |
if (!result.errors.length && !result.warnings.length) { | |
return acc; | |
} | |
const [firstLine, ...rest] = result.message.split('\n'); | |
const body = rest.join('\n').trim(); | |
const icon = result.errors.length ? '?' : '??'; | |
const hash = result.hash.substring(0, 8); | |
return `${acc} ${!body.length ? '\n\n' : ` | |
<details><summary>`} | |
${hash} - ${firstLine} ${!body.length ? '\n\n' : `\ | |
</summary> | |
${body} | |
</details> | |
`}${result.errors.map(error => ` | |
- ? ${error}`).join('')} ${result.warnings.map(warn => ` | |
- ?? ${warn}`).join('')}`; | |
}, header); | |
core.setOutput('comment', comment); | |
- name: Update PR | |
if: ${{ steps.commitlint.outcome == 'failure' && steps.prTitle.outcome == 'failure' }} | |
id: comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
header: commitlint | |
message: | | |
${{ steps.format.outputs.comment }} | |
- name: Fail Job on Error | |
if: ${{ steps.commitlint.outcome == 'failure' && steps.prTitle.outcome == 'failure' }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
core.setFailed("There were problems with this PR's commit messages") |