|
| 1 | +name: 'Lint PR' |
| 2 | + |
| 3 | +on: |
| 4 | + # This allows the action to be used in a fork-based workflow, where |
| 5 | + # e.g. you want to accept pull requests in a public repository. |
| 6 | + # In this case, the configuration from the main branch of your repository will be used for the |
| 7 | + # check. This means that you need to have this configuration in the main branch for the action to |
| 8 | + # run at all (e.g. it won't run within a PR that adds the action initially). |
| 9 | + # Also if you change the configuration in a PR, the changes will not be reflected for the current |
| 10 | + # PR – only subsequent ones after the changes are in the main branch. |
| 11 | + pull_request_target: |
| 12 | + types: |
| 13 | + - opened |
| 14 | + - edited |
| 15 | + - reopened |
| 16 | + |
| 17 | +jobs: |
| 18 | + main: |
| 19 | + name: Validate PR title |
| 20 | + runs-on: ubuntu-latest |
| 21 | + permissions: |
| 22 | + pull-requests: read |
| 23 | + steps: |
| 24 | + - uses: amannn/action-semantic-pull-request@v6 |
| 25 | + env: |
| 26 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + with: |
| 28 | + # Configure that a scope is optional |
| 29 | + requireScope: false |
| 30 | + # Configure additional validation for the subject based on a regex. |
| 31 | + # This ensures the subject doesn't start with an uppercase character. |
| 32 | + subjectPattern: ^(?![A-Z]).+$ |
| 33 | + # If `subjectPattern` is configured, you can use this property to override |
| 34 | + # the default error message that is shown when the pattern doesn't match. |
| 35 | + # The variables `subject` and `title` can be used within the message. |
| 36 | + subjectPatternError: | |
| 37 | + The subject "{subject}" found in the pull request title "{title}" |
| 38 | + didn't match the configured pattern. Please ensure that the subject |
| 39 | + doesn't start with an uppercase character. |
| 40 | + # If the PR contains one of these newline-delimited labels, the |
| 41 | + # validation is skipped. If you want to rerun the validation when |
| 42 | + # labels change, you might want to use the `labeled` and `unlabeled` |
| 43 | + # event triggers in your workflow. |
| 44 | + ignoreLabels: | |
| 45 | + bot |
| 46 | + ignore-semantic-pull-request |
0 commit comments