Skip to content
15 changes: 12 additions & 3 deletions .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ class GithubUtils {
labels: issue.labels,
PRList: this.getStagingDeployCashPRList(issue),
deployBlockers: this.getStagingDeployCashDeployBlockers(issue),
internalQAPRList: this.getStagingDeployCashInternalQA(issue),
isTimingDashboardChecked: /-\s\[x]\sI checked the \[App Timing Dashboard]/.test(issue.body),
isFirebaseChecked: /-\s\[x]\sI checked \[Firebase Crashlytics]/.test(issue.body),
tag,
Expand Down Expand Up @@ -260,8 +261,7 @@ class GithubUtils {
isAccessible: match[4] === 'x',
}),
);
const internalQAPRList = this.getStagingDeployCashInternalQA(issue);
return _.sortBy(_.union(PRList, internalQAPRList), 'number');
return _.sortBy(PRList, 'number');
}

/**
Expand Down Expand Up @@ -324,6 +324,7 @@ class GithubUtils {
* @param {Array} [accessiblePRList] - The list of PR URLs which have passed the accessability check.
* @param {Array} [deployBlockers] - The list of DeployBlocker URLs.
* @param {Array} [resolvedDeployBlockers] - The list of DeployBlockers URLs which have been resolved.
* @param {Array} [resolvedInternalQAPRs] - The list of Internal QA PR URLs which have been resolved.
* @param {Boolean} [isTimingDashboardChecked]
* @param {Boolean} [isFirebaseChecked]
* @returns {Promise}
Expand All @@ -335,6 +336,7 @@ class GithubUtils {
accessiblePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
resolvedInternalQAPRs = [],
isTimingDashboardChecked = false,
isFirebaseChecked = false,
) {
Expand All @@ -346,6 +348,11 @@ class GithubUtils {
);
console.log('Filtering out the following automated pull requests:', automatedPRs);

// The format of this map is following:
// {
// 'https://github.com/Expensify/App/pull/9641': [ 'PauloGasparSv', 'kidroca' ],
// 'https://github.com/Expensify/App/pull/9642': [ 'mountiny', 'kidroca' ]
// }
Comment on lines +351 to +355

@mountiny mountiny Jul 19, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this comment to explain what the format of the map will be as it is not immediately clear imho, which then probably lead to the bug.

const internalQAPRMap = _.reduce(
_.filter(data, pr => !_.isEmpty(_.findWhere(pr.labels, {name: INTERNAL_QA_LABEL}))),
(map, pr) => {
Expand Down Expand Up @@ -390,11 +397,13 @@ class GithubUtils {
});
}

// Internal QA PR list
if (!_.isEmpty(internalQAPRMap)) {
console.log('Found the following verified Internal QA PRs:', resolvedInternalQAPRs);
issueBody += '\r\n\r\n\r\n**Internal QA:**';
_.each(internalQAPRMap, (assignees, URL) => {
const assigneeMentions = _.reduce(assignees, (memo, assignee) => `${memo} @${assignee}`, '');
issueBody += `\r\n${_.contains(verifiedOrNoQAPRs, URL) ? '- [x]' : '- [ ]'} `;
issueBody += `\r\n${_.contains(resolvedInternalQAPRs, URL) ? '- [x]' : '- [ ]'} `;
Comment thread
neil-marcellini marked this conversation as resolved.
issueBody += `${URL}`;
issueBody += ` -${assigneeMentions}`;
});
Expand Down
15 changes: 12 additions & 3 deletions .github/actions/javascript/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ class GithubUtils {
labels: issue.labels,
PRList: this.getStagingDeployCashPRList(issue),
deployBlockers: this.getStagingDeployCashDeployBlockers(issue),
internalQAPRList: this.getStagingDeployCashInternalQA(issue),
isTimingDashboardChecked: /-\s\[x]\sI checked the \[App Timing Dashboard]/.test(issue.body),
isFirebaseChecked: /-\s\[x]\sI checked \[Firebase Crashlytics]/.test(issue.body),
tag,
Expand Down Expand Up @@ -230,8 +231,7 @@ class GithubUtils {
isAccessible: match[4] === 'x',
}),
);
const internalQAPRList = this.getStagingDeployCashInternalQA(issue);
return _.sortBy(_.union(PRList, internalQAPRList), 'number');
return _.sortBy(PRList, 'number');
}

/**
Expand Down Expand Up @@ -294,6 +294,7 @@ class GithubUtils {
* @param {Array} [accessiblePRList] - The list of PR URLs which have passed the accessability check.
* @param {Array} [deployBlockers] - The list of DeployBlocker URLs.
* @param {Array} [resolvedDeployBlockers] - The list of DeployBlockers URLs which have been resolved.
* @param {Array} [resolvedInternalQAPRs] - The list of Internal QA PR URLs which have been resolved.
* @param {Boolean} [isTimingDashboardChecked]
* @param {Boolean} [isFirebaseChecked]
* @returns {Promise}
Expand All @@ -305,6 +306,7 @@ class GithubUtils {
accessiblePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
resolvedInternalQAPRs = [],
Comment thread
roryabraham marked this conversation as resolved.
isTimingDashboardChecked = false,
isFirebaseChecked = false,
) {
Expand All @@ -316,6 +318,11 @@ class GithubUtils {
);
console.log('Filtering out the following automated pull requests:', automatedPRs);

// The format of this map is following:
// {
// 'https://github.com/Expensify/App/pull/9641': [ 'PauloGasparSv', 'kidroca' ],
// 'https://github.com/Expensify/App/pull/9642': [ 'mountiny', 'kidroca' ]
// }
const internalQAPRMap = _.reduce(
_.filter(data, pr => !_.isEmpty(_.findWhere(pr.labels, {name: INTERNAL_QA_LABEL}))),
(map, pr) => {
Expand Down Expand Up @@ -360,11 +367,13 @@ class GithubUtils {
});
}

// Internal QA PR list
if (!_.isEmpty(internalQAPRMap)) {
console.log('Found the following verified Internal QA PRs:', resolvedInternalQAPRs);
issueBody += '\r\n\r\n\r\n**Internal QA:**';
_.each(internalQAPRMap, (assignees, URL) => {
const assigneeMentions = _.reduce(assignees, (memo, assignee) => `${memo} @${assignee}`, '');
issueBody += `\r\n${_.contains(verifiedOrNoQAPRs, URL) ? '- [x]' : '- [ ]'} `;
issueBody += `\r\n${_.contains(resolvedInternalQAPRs, URL) ? '- [x]' : '- [ ]'} `;
issueBody += `${URL}`;
issueBody += ` -${assigneeMentions}`;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,20 @@ const run = function () {
'number',
);

// Get the internalQA PR list, preserving the previous state of `isResolved`
const internalQAPRList = _.sortBy(
currentStagingDeployCashData.internalQAPRList,
'number',
);
Comment on lines +125 to +129

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are first getting the list of the InternalQA PRs from the previous issue body.


return GithubUtils.generateStagingDeployCashBody(
newTag,
_.pluck(PRList, 'url'),
_.pluck(_.where(PRList, {isVerified: true}), 'url'),
_.pluck(_.where(PRList, {isAccessible: true}), 'url'),
_.pluck(deployBlockers, 'url'),
_.pluck(_.where(deployBlockers, {isResolved: true}), 'url'),
_.pluck(_.where(internalQAPRList, {isResolved: true}), 'url'),
didVersionChange ? false : currentStagingDeployCashData.isTimingDashboardChecked,
didVersionChange ? false : currentStagingDeployCashData.isFirebaseChecked,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then passing as a parameter an array of URLs of only those PRs which are resolved (the checkbox has been ticked)

);
Expand Down
22 changes: 19 additions & 3 deletions .github/actions/javascript/createOrUpdateStagingDeploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,20 @@ const run = function () {
'number',
);

// Get the internalQA PR list, preserving the previous state of `isResolved`
const internalQAPRList = _.sortBy(
currentStagingDeployCashData.internalQAPRList,
'number',
);

return GithubUtils.generateStagingDeployCashBody(
newTag,
_.pluck(PRList, 'url'),
_.pluck(_.where(PRList, {isVerified: true}), 'url'),
_.pluck(_.where(PRList, {isAccessible: true}), 'url'),
_.pluck(deployBlockers, 'url'),
_.pluck(_.where(deployBlockers, {isResolved: true}), 'url'),
_.pluck(_.where(internalQAPRList, {isResolved: true}), 'url'),
didVersionChange ? false : currentStagingDeployCashData.isTimingDashboardChecked,
didVersionChange ? false : currentStagingDeployCashData.isFirebaseChecked,
);
Expand Down Expand Up @@ -418,6 +425,7 @@ class GithubUtils {
labels: issue.labels,
PRList: this.getStagingDeployCashPRList(issue),
deployBlockers: this.getStagingDeployCashDeployBlockers(issue),
internalQAPRList: this.getStagingDeployCashInternalQA(issue),
isTimingDashboardChecked: /-\s\[x]\sI checked the \[App Timing Dashboard]/.test(issue.body),
isFirebaseChecked: /-\s\[x]\sI checked \[Firebase Crashlytics]/.test(issue.body),
tag,
Expand Down Expand Up @@ -452,8 +460,7 @@ class GithubUtils {
isAccessible: match[4] === 'x',
}),
);
const internalQAPRList = this.getStagingDeployCashInternalQA(issue);
return _.sortBy(_.union(PRList, internalQAPRList), 'number');
return _.sortBy(PRList, 'number');
}

/**
Expand Down Expand Up @@ -516,6 +523,7 @@ class GithubUtils {
* @param {Array} [accessiblePRList] - The list of PR URLs which have passed the accessability check.
* @param {Array} [deployBlockers] - The list of DeployBlocker URLs.
* @param {Array} [resolvedDeployBlockers] - The list of DeployBlockers URLs which have been resolved.
* @param {Array} [resolvedInternalQAPRs] - The list of Internal QA PR URLs which have been resolved.
* @param {Boolean} [isTimingDashboardChecked]
* @param {Boolean} [isFirebaseChecked]
* @returns {Promise}
Expand All @@ -527,6 +535,7 @@ class GithubUtils {
accessiblePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
resolvedInternalQAPRs = [],
isTimingDashboardChecked = false,
isFirebaseChecked = false,
) {
Expand All @@ -538,6 +547,11 @@ class GithubUtils {
);
console.log('Filtering out the following automated pull requests:', automatedPRs);

// The format of this map is following:
// {
// 'https://github.com/Expensify/App/pull/9641': [ 'PauloGasparSv', 'kidroca' ],
// 'https://github.com/Expensify/App/pull/9642': [ 'mountiny', 'kidroca' ]
// }
const internalQAPRMap = _.reduce(
_.filter(data, pr => !_.isEmpty(_.findWhere(pr.labels, {name: INTERNAL_QA_LABEL}))),
(map, pr) => {
Expand Down Expand Up @@ -582,11 +596,13 @@ class GithubUtils {
});
}

// Internal QA PR list
if (!_.isEmpty(internalQAPRMap)) {
console.log('Found the following verified Internal QA PRs:', resolvedInternalQAPRs);
issueBody += '\r\n\r\n\r\n**Internal QA:**';
_.each(internalQAPRMap, (assignees, URL) => {
const assigneeMentions = _.reduce(assignees, (memo, assignee) => `${memo} @${assignee}`, '');
issueBody += `\r\n${_.contains(verifiedOrNoQAPRs, URL) ? '- [x]' : '- [ ]'} `;
issueBody += `\r\n${_.contains(resolvedInternalQAPRs, URL) ? '- [x]' : '- [ ]'} `;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there so much code duplication for creating the internal QA PR list and getStagingDeployCashData in these Github actions? I'm very new to Github actions.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the documentation here

issueBody += `${URL}`;
issueBody += ` -${assigneeMentions}`;
});
Expand Down
15 changes: 12 additions & 3 deletions .github/actions/javascript/getPullRequestDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ class GithubUtils {
labels: issue.labels,
PRList: this.getStagingDeployCashPRList(issue),
deployBlockers: this.getStagingDeployCashDeployBlockers(issue),
internalQAPRList: this.getStagingDeployCashInternalQA(issue),
isTimingDashboardChecked: /-\s\[x]\sI checked the \[App Timing Dashboard]/.test(issue.body),
isFirebaseChecked: /-\s\[x]\sI checked \[Firebase Crashlytics]/.test(issue.body),
tag,
Expand Down Expand Up @@ -301,8 +302,7 @@ class GithubUtils {
isAccessible: match[4] === 'x',
}),
);
const internalQAPRList = this.getStagingDeployCashInternalQA(issue);
return _.sortBy(_.union(PRList, internalQAPRList), 'number');
return _.sortBy(PRList, 'number');
}

/**
Expand Down Expand Up @@ -365,6 +365,7 @@ class GithubUtils {
* @param {Array} [accessiblePRList] - The list of PR URLs which have passed the accessability check.
* @param {Array} [deployBlockers] - The list of DeployBlocker URLs.
* @param {Array} [resolvedDeployBlockers] - The list of DeployBlockers URLs which have been resolved.
* @param {Array} [resolvedInternalQAPRs] - The list of Internal QA PR URLs which have been resolved.
* @param {Boolean} [isTimingDashboardChecked]
* @param {Boolean} [isFirebaseChecked]
* @returns {Promise}
Expand All @@ -376,6 +377,7 @@ class GithubUtils {
accessiblePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
resolvedInternalQAPRs = [],
isTimingDashboardChecked = false,
isFirebaseChecked = false,
) {
Expand All @@ -387,6 +389,11 @@ class GithubUtils {
);
console.log('Filtering out the following automated pull requests:', automatedPRs);

// The format of this map is following:
// {
// 'https://github.com/Expensify/App/pull/9641': [ 'PauloGasparSv', 'kidroca' ],
// 'https://github.com/Expensify/App/pull/9642': [ 'mountiny', 'kidroca' ]
// }
const internalQAPRMap = _.reduce(
_.filter(data, pr => !_.isEmpty(_.findWhere(pr.labels, {name: INTERNAL_QA_LABEL}))),
(map, pr) => {
Expand Down Expand Up @@ -431,11 +438,13 @@ class GithubUtils {
});
}

// Internal QA PR list
if (!_.isEmpty(internalQAPRMap)) {
console.log('Found the following verified Internal QA PRs:', resolvedInternalQAPRs);
issueBody += '\r\n\r\n\r\n**Internal QA:**';
_.each(internalQAPRMap, (assignees, URL) => {
const assigneeMentions = _.reduce(assignees, (memo, assignee) => `${memo} @${assignee}`, '');
issueBody += `\r\n${_.contains(verifiedOrNoQAPRs, URL) ? '- [x]' : '- [ ]'} `;
issueBody += `\r\n${_.contains(resolvedInternalQAPRs, URL) ? '- [x]' : '- [ ]'} `;
issueBody += `${URL}`;
issueBody += ` -${assigneeMentions}`;
});
Expand Down
15 changes: 12 additions & 3 deletions .github/actions/javascript/getReleaseBody/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class GithubUtils {
labels: issue.labels,
PRList: this.getStagingDeployCashPRList(issue),
deployBlockers: this.getStagingDeployCashDeployBlockers(issue),
internalQAPRList: this.getStagingDeployCashInternalQA(issue),
isTimingDashboardChecked: /-\s\[x]\sI checked the \[App Timing Dashboard]/.test(issue.body),
isFirebaseChecked: /-\s\[x]\sI checked \[Firebase Crashlytics]/.test(issue.body),
tag,
Expand Down Expand Up @@ -219,8 +220,7 @@ class GithubUtils {
isAccessible: match[4] === 'x',
}),
);
const internalQAPRList = this.getStagingDeployCashInternalQA(issue);
return _.sortBy(_.union(PRList, internalQAPRList), 'number');
return _.sortBy(PRList, 'number');
}

/**
Expand Down Expand Up @@ -283,6 +283,7 @@ class GithubUtils {
* @param {Array} [accessiblePRList] - The list of PR URLs which have passed the accessability check.
* @param {Array} [deployBlockers] - The list of DeployBlocker URLs.
* @param {Array} [resolvedDeployBlockers] - The list of DeployBlockers URLs which have been resolved.
* @param {Array} [resolvedInternalQAPRs] - The list of Internal QA PR URLs which have been resolved.
* @param {Boolean} [isTimingDashboardChecked]
* @param {Boolean} [isFirebaseChecked]
* @returns {Promise}
Expand All @@ -294,6 +295,7 @@ class GithubUtils {
accessiblePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
resolvedInternalQAPRs = [],
isTimingDashboardChecked = false,
isFirebaseChecked = false,
) {
Expand All @@ -305,6 +307,11 @@ class GithubUtils {
);
console.log('Filtering out the following automated pull requests:', automatedPRs);

// The format of this map is following:
// {
// 'https://github.com/Expensify/App/pull/9641': [ 'PauloGasparSv', 'kidroca' ],
// 'https://github.com/Expensify/App/pull/9642': [ 'mountiny', 'kidroca' ]
// }
const internalQAPRMap = _.reduce(
_.filter(data, pr => !_.isEmpty(_.findWhere(pr.labels, {name: INTERNAL_QA_LABEL}))),
(map, pr) => {
Expand Down Expand Up @@ -349,11 +356,13 @@ class GithubUtils {
});
}

// Internal QA PR list
if (!_.isEmpty(internalQAPRMap)) {
console.log('Found the following verified Internal QA PRs:', resolvedInternalQAPRs);
issueBody += '\r\n\r\n\r\n**Internal QA:**';
_.each(internalQAPRMap, (assignees, URL) => {
const assigneeMentions = _.reduce(assignees, (memo, assignee) => `${memo} @${assignee}`, '');
issueBody += `\r\n${_.contains(verifiedOrNoQAPRs, URL) ? '- [x]' : '- [ ]'} `;
issueBody += `\r\n${_.contains(resolvedInternalQAPRs, URL) ? '- [x]' : '- [ ]'} `;
issueBody += `${URL}`;
issueBody += ` -${assigneeMentions}`;
});
Expand Down
Loading