-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feature: Added CI to verify proper formatting of PR titles. #7470
Conversation
Signed-off-by: ayushrakesh <ayushrakesh.05@gmail.com>
Signed-off-by: ayushrakesh <ayushrakesh.05@gmail.com>
Signed-off-by: ayushrakesh <ayushrakesh.05@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR title format's still wrong to me.
Plus now we have two source of information regarding how PRs should be written. I would prefer to have one source and link them.
I'm also not sure about how helpful this linting is. It can block a PR from being merged when there are legitimate reasons to break the pattern. It's very easy and fast for any maintainer to edit the title of a PR before merging it.
Curious to see what other maintainers have to say about this.
.github/workflows/pr-title-check.yml
Outdated
PREFIXES="query:|.*:" | ||
|
||
if [[ ! "${{ github.event.pull_request.title }}" =~ ^(${PREFIXES}) ]]; then | ||
echo "PR title does not follow the required format: 'prefix: description'" | ||
echo "::error::PR title must start with one of the following prefixes: query:, .*:" | ||
exit 1 | ||
else | ||
echo "PR title is valid." | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still wrong. Please reread the pull request template. The allowed prefix is not only query:
and .*:
(note that .*
here isn't a regex it means "something that applies to all components).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@douglascamata Okay, means "query" or some single word that applies to all components right? If it is then can you suggest what could be best possible word?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR title, as the pull request template says, should start with the name of the Thanos component involved in the PR. We have a list of the components in the official docs (https://thanos.io/tip/components/).
You can also check the history of PRs. You might see some that affected one or more components at the same time. For sure some that affected all of them too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PREFIXES="query:|compactor:|query-frontend:|receiver:|rule:|sidecar:|store:|tools:"
@douglascamata Is this exactly correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're missing the .*
(string) prefix, which has to be escaped to not be confused with the meaning that .*
has in regexes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PREFIXES="query:|compactor:|query-frontend:|receiver:|rule:|sidecar:|store:|tools:|\.\*:"
Yes, I see that for using .*
in bash script as a regex we have to escape it like above. Is this right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@douglascamata Please review the revised PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@douglascamata Sorry for closing this, something wrong, some files have got unintentionally changed.
I have made another PR for this. Please check it out. #7483
Signed-off-by: ayushrakesh <ayushrakesh.05@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are just noise. Same applies to many other files the same folder.
#### Examples | ||
- `query: Optimize search query performance` | ||
- `query: Add new filters to the query module` | ||
- `store: Improve data storage efficiency` | ||
- `api: Update API endpoint for user data` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about multi-component PRs like #7406?
What about a PR like this one itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@douglascamata
For PRs involving multiple components, maybe we can use syntax like this -> query,store: Enhance data retrieval efficiency
. What you say?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems okay to me. But mind that I'm not a maintainer, so my review is not conclusive. A maintainer will still have to review this.
Added one CI to check that PR titles are properly formatted.
Changes
Added one .yaml file for CI.
Verification
make test