Skip to content

Commit

Permalink
add pr-title validation
Browse files Browse the repository at this point in the history
  • Loading branch information
egekocabas committed Nov 11, 2024
1 parent bb30079 commit 68a24f6
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/pr-title-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Chore
on:
pull_request:
branches: [main]
types: [opened, reopened, edited, synchronize]

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

jobs:
check-pr-title:
name: PR title validation
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: validate conventional commit message
id: lint
uses: amannn/action-semantic-pull-request@v5
with:
subjectPattern: ^[A-Z].+[^. ]$ # subject must start with uppercase letter and may not end with a dot/space
env:
GITHUB_TOKEN: ${{ github.token }}
- name: post comment about invalid PR title
if: failure()
uses: marocchino/sticky-pull-request-comment@v2
with:
header: conventional-commit-pr-title
message: |
Thanks for contributing to Helios 🌞
Please use PR titles according to [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
<details><summary><b>Details</b></summary>
```
${{ steps.lint.outputs.error_message }}
```
</details>
- name: delete comment about invalid PR title
if: success()
uses: marocchino/sticky-pull-request-comment@v2
with:
header: conventional-commit-pr-title
delete: true

0 comments on commit 68a24f6

Please sign in to comment.