Revert changes to pr-gh-project, Neil will update this separately

This commit is contained in:
Richard Cox 2024-05-02 10:12:41 +01:00
parent 27c90c0668
commit 11393c83e4
1 changed files with 26 additions and 35 deletions

View File

@ -9,7 +9,7 @@ const request = require('./request');
const TECH_DEBT_LABEL = 'kind/tech-debt';
const DEV_VALIDATE_LABEL = 'status/dev-validate';
const QA_NONE_LABEL = 'QA/None';
const QA_DEV_AUTOMATION_LABEL = 'QA/dev-automation';
const QA_DEV_AUTOMATION_LABEL = 'QA/dev-automation'
const GH_PRJ_TO_TEST = 'To Test';
const GH_PRJ_QA_REVIEW = 'QA Review';
@ -54,17 +54,12 @@ function getReferencedIssues(body) {
const regexp = /[Ff]ix(es|ed)?\s*#([0-9]*)|[Cc]lose(s|d)?\s*#([0-9]*)|[Rr]esolve(s|d)?\s*#([0-9]*)/g;
var v;
const issues = [];
try {
do {
v = regexp.exec(body);
if (v) {
issues.push(parseInt(v[2], 10));
}
} while (v);
} catch (err) {
console.error('Failed to find referenced issues', err);
}
return issues;
}
@ -116,6 +111,7 @@ async function processClosedAction() {
return;
}
console.log('======');
console.log('Processing Closed PR #' + pr.number + ' : ' + pr.title);
console.log('======');
@ -137,7 +133,7 @@ async function processClosedAction() {
// Need to get all open PRs to see if any other references the same issues that this PR says it fixes
const openPRs = event.repository.url + '/pulls?state=open&per_page=100';
const r = await request.fetch(openPRs);
const issueMap = issues.reduce((prev, issue) => { prev[issue] = true; return prev; }, {});
const issueMap = issues.reduce((prev, issue) => { prev[issue] = true; return prev; }, {})
// Go through all of the Open PRs and see if they fix any of the same issues that this PR does
// If not, then the issue has been completed, so we can process it
@ -162,7 +158,7 @@ async function processClosedAction() {
fixed.forEach(async (i) => {
const detail = event.repository.url + '/issues/' + i;
const iss = await request.fetch(detail);
console.log('');
console.log('')
console.log('Processing Issue #' + i + ' - ' + iss.title);
// If the issue is a tech debt issue or says dev will validate then don't move it to 'To Test'
@ -267,12 +263,7 @@ async function processOpenOrEditAction() {
for (i of issues) {
const detail = `${event.repository.url}/issues/${i}`;
const iss = await request.fetch(detail);
if (!iss) {
console.log(`Failed to find issue with number '${i}'. Body: :`, iss);
continue;
}
console.log('');
console.log('')
console.log('Processing Issue #' + i + ' - ' + iss.title);
if (pr.draft) {
@ -311,7 +302,7 @@ async function processOpenOrEditAction() {
}
}
if (iss?.milestone) {
if (iss.milestone) {
milestones[iss.milestone.title] = iss.milestone.number;
}
}