Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 18 additions & 23 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,25 @@ jobs:
permissions:
pull-requests: read
steps:
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
- name: Validate PR title
id: lint_pr_title
uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
- name: Report PR title error
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Hey there and thank you for opening this pull request! 👋🏼

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.

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@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5
with:
header: pr-title-lint-error
delete: true
env:
ERROR_MESSAGE: ${{ steps.lint_pr_title.outputs.error_message }}
run: |
{
echo "## PR title does not follow Conventional Commits"
echo
echo "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."
echo
echo "Details:"
echo
echo '```'
printf '%s\n' "$ERROR_MESSAGE"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
21 changes: 21 additions & 0 deletions .github/workflows/lint-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Lint PR title

on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint-pr-title:
permissions:
pull-requests: read
uses: ./.github/workflows/conventional-commits.yml
2 changes: 1 addition & 1 deletion conventional-commits/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
## 📋 Implementation Notes
- 🔄 The workflow runs automatically when PRs are opened, edited, or reopened to ensure continuous validation
- ✅ It validates the PR title against the Conventional Commits specification with comprehensive checks
- 💬 If validation fails, the workflow will comment on the PR with detailed guidance on how to fix the title
- 💬 If validation fails, the workflow writes detailed guidance on how to fix the title to the job summary
- 🔗 This workflow is particularly useful when combined with the release-please workflow for a fully automated release process
- 🚀 Helps maintain a high-quality repository that's ready for automated versioning and changelog generation

Expand Down
2 changes: 1 addition & 1 deletion conventional-commits/workflow-sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f4d93a8c6e9661da06e9cdc25bc14514ce8ba762289824d22b4e38ed55d53f45
7b63fac2d587df6d61130b3df42e93f8e7bb41f6e7b163bae20c452e4b4f02b3
Loading