Skip to content

Commit 78a6105

Browse files
authored
chore(pull-requests): enforce conventional commits (#29438)
Issue number: N/A --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Framework has a structure when it comes to PR titles. However, there aren't any reinforcements to it unless a reviewer checks it. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Added a GitHub action that will validate the PR title. It checks that there is a valid type, checks that it has a scope, and that the subject doesn't start with a uppercase character. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Create a branch from this one to test it out.
1 parent ee83388 commit 78a6105

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: PR Conventional Commit Validation
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, edited]
6+
7+
jobs:
8+
validate-pr-title:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Validate PR title
12+
uses: amannn/action-semantic-pull-request@v5
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
with:
16+
# Configure that a scope must always be provided.
17+
requireScope: true
18+
# Configure additional validation for the subject based on a regex.
19+
# This example ensures the subject doesn't start with an uppercase character.
20+
subjectPattern: ^(?![A-Z]).+$
21+
# If `subjectPattern` is configured, you can use this property to
22+
# override the default error message that is shown when the pattern
23+
# doesn't match. The variables `subject` and `title` can be used
24+
# within the message.
25+
subjectPatternError: |
26+
The subject "{subject}" found in the pull request title "{title}" didn't match the configured pattern. Please ensure that the subject doesn't start with an uppercase character.

0 commit comments

Comments
 (0)