dangerjs: support "No related issues" under "Related" section

pull/10856/head
Fu Hanxi 2023-02-22 10:07:35 +08:00
rodzic 0daa40f3ad
commit 04209244a9
2 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -62,10 +62,15 @@ function checkMrJiraLinks() {
const mrCommitMessages = danger.gitlab.commits.map(commit => commit.message);
const matchBlockRelated = mrDescription.match(/\#\# Related.*$/s); // Match MR description starting with line ## Related till the end of MR description
const noRelatedIssues = /No related issues/.test(matchBlockRelated ? matchBlockRelated[0] : ''); // Check if there is "No related issues"
const testJiraLabels = /[A-Z]+-[0-9]+/.test(matchBlockRelated ? matchBlockRelated[0] : ''); // Test if pattern of Jira label "JIRA-1234" or "RDT-311" is in section Related
const ghIssueTicket = /IDFGH-[0-9]+/.test(matchBlockRelated ? matchBlockRelated[0] : ''); // Check if there is JIRA link starts with "IDFGH-*" in MR description, section "Related"
const testGithubLink = /Closes https:\/\/github\.com\/espressif\/esp-idf\/issues\/[0-9]+/
if (mrDescription.toUpperCase().includes("## RELATED") && noRelatedIssues) {
return
}
if (!mrDescription.toUpperCase().includes("## RELATED") || !testJiraLabels) { // Missing section "Related" or missing links to JIRA tickets
return warn("Please add links to JIRA issues to the MR description section `Related`.");

Wyświetl plik

@ -7,7 +7,7 @@
<!-- Add description of the change here --><!-- Mandatory -->
## Related <!-- Optional -->
<!-- Related Jira issues and Github issues -->
<!-- Related Jira issues and Github issues or write "No related issues"-->
## Release notes <!-- Mandatory -->
<!-- Either state release notes or write "No release notes" -->