Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add error comment in lint-pr-title.yml #175

Closed
wants to merge 8 commits into from

Conversation

Krishks369
Copy link
Contributor

I have added feature in the lint-pr-title.yml file to comment on the lint errors in the title while PR is created

Three scenarios are there for the workflow

  1. When the PR title is not in the correct format i.e when it is apart from titles like feat, fix etc. It works like it has in this PR .

  2. When the PR title is not found or the PR subject starts in capital, then it works like in this PR

  3. When the lint is corrected after the comment, the comment is then deleted from the PR, as mentioned in https://github.com/marocchino/sticky-pull-request-comment

Although the action used for linting the title is https://github.com/amannn/action-semantic-pull-request I have forked and used this feature before it got merged in the main action. So temporarily it uses https://github.com/Krishks369/action-semantic-pull-request.

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments

with:
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}" should start with a lowercase character.

# Comments the error message from the above lint_pr_title action and deletes the comment when the linting is correct
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this comment accurate?

with:
header: comment
message: |
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. I would only suggest we add some additional message, from our side, with some emoji, not to have such a raw output as they provide in the action that we use.

So the error from amannn/action-semantic-pull-request is shown as code, but before it, we should have some highlight, like maybe Hey there 👋🏼 thanks for opening the PR but we need you to adjust the title of the pull request. We require all PRs to follow Conventional Commits specification. More details 👇🏼

you know what I mean?

name: delete the comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: comment
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you tested it, right?

@derberg
Copy link
Member

derberg commented Sep 21, 2022

@Krishks369 hey man, need a hand?

@Krishks369 Krishks369 closed this Sep 23, 2022
@Krishks369 Krishks369 deleted the krishna/lint-pr-title branch September 23, 2022 16:59
@sambhavgupta0705
Copy link
Member

Hey @derberg ,do we need to refine this PR also?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants