Skip to content
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: PR Comment

on:
workflow_run:
workflows: ['e2e-tests', 'PR Description']
workflows: ['e2e-tests', 'PR Description', 'PR Title']
types:
- completed

Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/pr-title-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: PR Title
# ^~~ if changed, update comment.yml as well

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

permissions:
contents: read

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ERR_MSG: |-
The PR title `${{ github.event.pull_request.title }}` does not follow the Calimero-Network Commit Message Convention
https://github.com/calimero-network/core/blob/master/CONTRIBUTING.md#commit-message-style

Our PR title should have the following structure:

<type>(<scope>): <subject>

Common errors to avoid:
1. The commit header <type>(<scope>): <subject> must be in lower case.
2. Allowed type values are: build, ci, docs, feat, fix, perf, refactor, test.

steps:
- uses: amannn/action-semantic-pull-request@v5
id: lint_pr_title

- name: Create PR Comment Payload
if: ${{ !cancelled() }}
run: >-
jq -n
--arg pr '${{ github.event.number }}'
--arg tag pr-lint-check
--arg mode "${{ steps.lint_pr_title.outputs.error_message != null && 'recreate' || 'delete' }}"
--arg message "${{ env.ERR_MSG }}"
'{pr: $pr, tag: $tag, mode: $mode, message: $message}' | tee payload.json

- name: Upload Comment
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: pr-comment-payload
path: payload.json