Skip to content

Commit

Permalink
ci: avoid task duplication and add develop label (#32889)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo authored Jul 24, 2024
1 parent 39fb14e commit a0578b1
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions apps/meteor/reporters/jira.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ class JIRAReporter implements Reporter {
console.log(`Sending test result to JIRA: ${JSON.stringify(payload)}`);

// first search and check if there is an existing issue

// replace all ()[]- with nothing
const search = await fetch(
`${this.url}/rest/api/2/search?${new URLSearchParams({
jql: `project = FLAKY AND summary ~ '${payload.name}'`,
jql: `project = FLAKY AND summary ~ '${payload.name.replace(/[\(\)\[\]-]/g, '')}'`,
})}`,
{
method: 'GET',
Expand Down Expand Up @@ -104,6 +104,25 @@ class JIRAReporter implements Reporter {
if (existing) {
const { location } = test;

if (this.pr === 0) {
await fetch(`${this.url}/rest/api/2/issue/${existing.key}`, {
method: 'PUT',
body: JSON.stringify({
update: {
labels: [
{
add: 'flaky_Develop',
},
],
},
}),
headers: {
'Content-Type': 'application/json',
'Authorization': `Basic ${this.apiKey}`,
},
});
}

await fetch(`${this.url}/rest/api/2/issue/${existing.key}/comment`, {
method: 'POST',
body: JSON.stringify({
Expand Down Expand Up @@ -146,6 +165,7 @@ ${this.run_url}
project: {
key: 'FLAKY',
},
...(this.pr === 0 && { labels: ['flaky_Develop'] }),
},
};

Expand Down

0 comments on commit a0578b1

Please sign in to comment.