Merge branch 'ci/fix_dangerjs_with_null_jira_issue_description' into 'master'

ci: fix dangerjs when jira link has null description

See merge request espressif/esp-idf!22770
This commit is contained in:
Fu Hanxi
2023-03-15 13:58:02 +08:00

View File

@@ -165,7 +165,7 @@ module.exports = async function () {
* or null if not found. * or null if not found.
*/ */
async function getGitHubClosingLink(jiraIssueKey) { async function getGitHubClosingLink(jiraIssueKey) {
let jiraDescrition = ""; let jiraDescription = "";
// Get JIRA ticket description content // Get JIRA ticket description content
try { try {
@@ -176,7 +176,9 @@ module.exports = async function () {
password: process.env.DANGER_JIRA_PASSWORD, password: process.env.DANGER_JIRA_PASSWORD,
}, },
}); });
jiraDescrition = response.data.fields.description; if (response.data.fields.description) {
jiraDescription = response.data.fields.description;
}
} catch (error) { } catch (error) {
return null; return null;
} }
@@ -184,7 +186,7 @@ module.exports = async function () {
// Find GitHub closing link in description // Find GitHub closing link in description
const regexClosingGhLink = const regexClosingGhLink =
/Closes\s+(https:\/\/github.com\/\S+\/\S+\/issues\/\d+)/; /Closes\s+(https:\/\/github.com\/\S+\/\S+\/issues\/\d+)/;
const closingGithubLink = jiraDescrition.match(regexClosingGhLink); const closingGithubLink = jiraDescription.match(regexClosingGhLink);
if (closingGithubLink) { if (closingGithubLink) {
return closingGithubLink[1]; return closingGithubLink[1];