-
Notifications
You must be signed in to change notification settings - Fork 75
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
ci: Pr label milestone check #2533
Conversation
fc37f65
to
436d6a5
Compare
436d6a5
to
c6cfd6c
Compare
Signed-off-by: Alfredo Gutierrez <[email protected]>
Quality Gate passedIssues Measures |
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.
Great addition! Love it!
@Nana-EC We should make this |
throw new Error('The PR has no labels.'); | ||
} | ||
if (!prMilestone) { | ||
throw new Error('The PR has no milestone.'); | ||
} | ||
|
||
const issueNumberMatches = prBody.match(/#(\d+)/g); | ||
|
||
if (!issueNumberMatches) { | ||
console.log('No associated issues found in PR description.'); | ||
} else { | ||
for (const match of issueNumberMatches) { | ||
const issueNumber = match.replace('#', ''); | ||
const issue = await getIssueDetails(issueNumber); | ||
const { labels: issueLabels, milestone: issueMilestone } = issue; | ||
|
||
if (issueLabels.length === 0) { | ||
throw new Error(`Associated issue #${issueNumber} has no labels.`); | ||
} | ||
if (!issueMilestone) { | ||
throw new Error(`Associated issue #${issueNumber} has no milestone.`); | ||
} |
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.
@Nana-EC before merging, I want to confirm with you that both the issue(s) and the PR, need to have labels and milestones set.
Also, if there are no issue related, no problem, this is to allow PRs opened by Snyks and dependabot, as well as some cherry-picks and other PRs that usually don't have related issues.
I agree, but let's merge first it and leave it as |
Description:
Related issue(s):
Fixes #2534
Notes for reviewer:
When the PR has no Labels:
When the PR has no Milestone:
When the associated Ticket has no milestone:
When everything has labels and milestones:
Checklist