feat(alert): add pf-alert #5978
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
# This workflow will validate the title of a PR to ensure it meets conventional commit standards | |
name: Validate conventional commit syntax | |
on: | |
pull_request: | |
types: | |
- opened | |
- edited | |
- labeled | |
- auto_merge_enabled | |
- synchronize | |
- reopened | |
- ready_for_review | |
pull_request_review: | |
types: | |
- submitted | |
env: | |
TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
# Separate jobs can run concurrently | |
jobs: | |
prTitle: | |
name: Validate conventional commit format for title | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# https://github.com/wagoid/commitlint-github-action/issues/560#issuecomment-1277659864 | |
- run: rm tsconfig.json | |
- uses: wagoid/commitlint-github-action@v5 | |
id: commitlint | |
continue-on-error: true | |
with: | |
configFile: .commitlintrc.cjs | |
- name: Validate conventional commit format for title | |
id: prTitle | |
if: ${{ steps.commitlint.outcome == 'failure' }} | |
uses: aslafy-z/[email protected] | |
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@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const results = ${{ steps.commitlint.outputs.results }}; | |
const titleGood = ${{ steps.prTitle.outputs.success }}; | |
const { format } = await import('${{ github.workspace }}/scripts/format-commitlint-messages.js'); | |
return format({ core, results, titleGood }); | |
- name: Notify PR | |
if: ${{ steps.commitlint.outcome == 'failure' && steps.prTitle.outputs.success == 'false' }} | |
id: comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
header: commitlint | |
message: | | |
${{ steps.format.outputs.result }} | |
- name: Fail Job on Error | |
if: ${{ steps.commitlint.outcome == 'failure' && steps.prTitle.outputs.success == 'false' }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.setFailed("There were problems with this PR's commit messages") | |