Skip to content

Commit

Permalink
ci: Update PR title CI (#2755)
Browse files Browse the repository at this point in the history
## What ❔

Updates the CI for PR title validation.

- Old action is unmaintained, switching to the modern one.
- New workflow would leave a helpful comment if check fails (and removes
it once it passes).

## Why ❔

DevEx

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.
  • Loading branch information
popzxc authored Aug 28, 2024
1 parent f37b84a commit ddfe235
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Check PR title
on:
pull_request_target:
pull_request:
types:
- opened
- reopened
Expand All @@ -12,7 +12,38 @@ jobs:
runs-on: ubuntu-latest
permissions:
statuses: write
pull-requests: write
steps:
- uses: aslafy-z/conventional-pr-title-action@v3
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Hey there! 👋🏼
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
Examples of valid PR titles:
- feat(eth_sender): Support new transaction type
- fix(state_keeper): Correctly handle edge case
- ci: Add new workflow for linting
Details:
```
${{ steps.lint_pr_title.outputs.error_message }}
```
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2
with:
header: pr-title-lint-error
delete: true

0 comments on commit ddfe235

Please sign in to comment.