Skip to content

Commit

Permalink
feat(ci): add lint pipeline for PRs (#1839)
Browse files Browse the repository at this point in the history
Adds a CI step that validates the pull request title to ensure that it complies with the conventional commit specifications. A pipeline will be triggered upon opening a pull request and upon renaming the pull request title.

Signed-off-by: ozkanonur <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed May 26, 2023
1 parent 9a0fe0f commit 22f7a93
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "PR Lint"

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

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
fix
chore
docs
deps
test
refactor
ci
requireScope: true
# Do not allow starting with uppercase for subject part
subjectPattern: ^(?![A-Z]).+$
headerPatternCorrespondence: type, scope, subject

- name: Check PR title length
env:
TITLE: ${{ github.event.pull_request.title }}
run: |
title_length=${#TITLE}
if [ $title_length -gt 72 ]
then
echo "PR title is too long (greater than 72 characters)"
exit 1
fi

0 comments on commit 22f7a93

Please sign in to comment.