Skip to content

Commit

Permalink
Merge branch 'main' into cmartins-refactorPolicyList
Browse files Browse the repository at this point in the history
  • Loading branch information
luacmartins committed Jul 14, 2022
2 parents bb2bddc + 79836db commit c994c8d
Show file tree
Hide file tree
Showing 30 changed files with 443 additions and 280 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/Accessibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Accessibility issue template
about: A template to follow when creating a new issue for accessibility failures
---

If you haven’t already, check out our [contributing guidelines](https://github.com/Expensify/ReactNativeChat/blob/main/docs/CONTRIBUTING.md) for onboarding and email contributors@expensify.com to request to join our Slack channel!
If you haven’t already, check out our [contributing guidelines](https://github.com/Expensify/ReactNativeChat/blob/main/contributingGuides/CONTRIBUTING.md) for onboarding and email contributors@expensify.com to request to join our Slack channel!
___

## Action Performed:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/Performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: "[Performance] "
labels: Engineering, Daily
---

If you haven’t already, check out our [contributing guidelines](https://github.com/Expensify/ReactNativeChat/blob/main/docs/CONTRIBUTING.md) for onboarding and email contributors@expensify.com to request to join our Slack channel!
If you haven’t already, check out our [contributing guidelines](https://github.com/Expensify/ReactNativeChat/blob/main/contributingGuides/CONTRIBUTING.md) for onboarding and email contributors@expensify.com to request to join our Slack channel!
___

## What performance issue do we need to solve?
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/Standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ about: A standard template to follow when creating a new issue in this repositor
labels: AutoAssignerTriage, Daily
---

If you haven’t already, check out our [contributing guidelines](https://github.com/Expensify/ReactNativeChat/blob/main/docs/CONTRIBUTING.md) for onboarding and email contributors@expensify.com to request to join our Slack channel!
If you haven’t already, check out our [contributing guidelines](https://github.com/Expensify/ReactNativeChat/blob/main/contributingGuides/CONTRIBUTING.md) for onboarding and email contributors@expensify.com to request to join our Slack channel!
___

## Action Performed:
Expand Down
16 changes: 8 additions & 8 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This is a checklist for PR authors & reviewers. Please make sure to complete all
- [ ] I added steps for Staging and/or Production testing in the `QA steps` section
- [ ] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
- [ ] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
- [ ] I included screenshots or videos for tests on [all platforms](https://github.com/Expensify/App/blob/main/docs/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [ ] I included screenshots or videos for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [ ] I ran the tests on **all platforms** & verified they passed on:
- [ ] iOS / native
- [ ] Android / native
Expand All @@ -51,16 +51,16 @@ This is a checklist for PR authors & reviewers. Please make sure to complete all
- [ ] MacOS / Chrome
- [ ] MacOS / Desktop
- [ ] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
- [ ] I followed proper code patterns (see [Reviewing the code](https://github.com/Expensify/App/blob/main/docs/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
- [ ] I followed proper code patterns (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
- [ ] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`)
- [ ] I verified that comments were added to code that is not self explanatory
- [ ] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
- [ ] I verified any copy / text shown in the product was added in all `src/languages/*` files
- [ ] I verified any copy / text that was added to the app is correct English and approved by marketing by tagging the marketing team on the original GH to get the correct copy.
- [ ] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
- [ ] I verified the JSDocs style guidelines (in [`STYLE.md`](https://github.com/Expensify/App/blob/main/docs/STYLE.md#jsdocs)) were followed
- [ ] I verified the JSDocs style guidelines (in [`STYLE.md`](https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#jsdocs)) were followed
- [ ] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- [ ] I followed the guidelines as stated in the [Review Guidelines](https://github.com/Expensify/App/blob/main/docs/PR_REVIEW_GUIDELINES.md)
- [ ] I followed the guidelines as stated in the [Review Guidelines](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md)
- [ ] I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like `Avatar`, I verified the components using `Avatar` are working as expected)
- [ ] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- [ ] I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
Expand Down Expand Up @@ -95,7 +95,7 @@ The Contributor+ will copy/paste it into a new comment and complete it after the
- [ ] I verified the steps for Staging and/or Production testing are in the `QA steps` section
- [ ] I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
- [ ] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
- [ ] I checked that screenshots or videos are included for tests on [all platforms](https://github.com/Expensify/App/blob/main/docs/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [ ] I checked that screenshots or videos are included for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [ ] I verified tests pass on **all platforms** & I tested again on:
- [ ] iOS / native
- [ ] Android / native
Expand All @@ -104,16 +104,16 @@ The Contributor+ will copy/paste it into a new comment and complete it after the
- [ ] MacOS / Chrome
- [ ] MacOS / Desktop
- [ ] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
- [ ] I verified proper code patterns were followed (see [Reviewing the code](https://github.com/Expensify/App/blob/main/docs/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
- [ ] I verified proper code patterns were followed (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
- [ ] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`).
- [ ] I verified that comments were added to code that is not self explanatory
- [ ] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
- [ ] I verified any copy / text shown in the product was added in all `src/languages/*` files
- [ ] I verified any copy / text that was added to the app is correct English and approved by marketing by tagging the marketing team on the original GH to get the correct copy.
- [ ] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
- [ ] I verified the JSDocs style guidelines (in [`STYLE.md`](https://github.com/Expensify/App/blob/main/docs/STYLE.md#jsdocs)) were followed
- [ ] I verified the JSDocs style guidelines (in [`STYLE.md`](https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#jsdocs)) were followed
- [ ] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- [ ] I verified that this PR follows the guidelines as stated in the [Review Guidelines](https://github.com/Expensify/App/blob/main/docs/PR_REVIEW_GUIDELINES.md)
- [ ] I verified that this PR follows the guidelines as stated in the [Review Guidelines](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md)
- [ ] I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like `Avatar`, I verified the components using `Avatar` have been tested & I retested again)
- [ ] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- [ ] I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ const run = function () {
console.log('New version found from action input:', newVersion);

let shouldCreateNewStagingDeployCash = false;
let currentStagingDeployCashIssueNumber = null;
let newTag = newVersion;
let newDeployBlockers = [];
let previousStagingDeployCashData = {};
let currentStagingDeployCashData = null;

// Start by fetching the list of recent StagingDeployCash issues, along with the list of open deploy blockers
return Promise.all([
Expand Down Expand Up @@ -37,6 +40,12 @@ const run = function () {
console.log('Failed fetching DeployBlockerCash issues from Github, continuing...');
}

newDeployBlockers = _.map(deployBlockerResponse.data, ({html_url}) => ({
url: html_url,
number: GithubUtils.getIssueOrPullRequestNumberFromURL(html_url),
isResolved: false,
}));

// Look at the state of the most recent StagingDeployCash,
// if it is open then we'll update the existing one, otherwise, we'll create a new one.
shouldCreateNewStagingDeployCash = Boolean(stagingDeployResponse.data[0].state !== 'open');
Expand All @@ -52,46 +61,37 @@ const run = function () {

// Parse the data from the previous StagingDeployCash
// (newest if there are none open, otherwise second-newest)
const previousStagingDeployCashData = shouldCreateNewStagingDeployCash
previousStagingDeployCashData = shouldCreateNewStagingDeployCash
? GithubUtils.getStagingDeployCashData(stagingDeployResponse.data[0])
: GithubUtils.getStagingDeployCashData(stagingDeployResponse.data[1]);

console.log('Found tag of previous StagingDeployCash:', previousStagingDeployCashData.tag);

// Find the list of PRs merged between the last StagingDeployCash and the new version
if (shouldCreateNewStagingDeployCash) {
// Find the list of PRs merged between the last StagingDeployCash and the new version
const mergedPRs = GitUtils.getPullRequestsMergedBetween(previousStagingDeployCashData.tag, newVersion);
// eslint-disable-next-line max-len
console.log(`The following PRs have been merged between the previous StagingDeployCash (${previousStagingDeployCashData.tag}) and new version (${newVersion}):`, mergedPRs);
return GitUtils.getPullRequestsMergedBetween(previousStagingDeployCashData.tag, newTag);
}

currentStagingDeployCashData = GithubUtils.getStagingDeployCashData(stagingDeployResponse.data[0]);
console.log('Parsed the following data from the current StagingDeployCash:', currentStagingDeployCashData);

// If we aren't sent a tag, then use the existing tag
newTag = newTag || currentStagingDeployCashData.tag;

return GitUtils.getPullRequestsMergedBetween(previousStagingDeployCashData.tag, newTag);
})
.then((mergedPRs) => {
console.log(`The following PRs have been merged between the previous StagingDeployCash (${previousStagingDeployCashData.tag}) and new version (${newVersion}):`, mergedPRs);

// TODO: if there are open DeployBlockers and we are opening a new checklist,
// then we should close / remove the DeployBlockerCash label from those
if (shouldCreateNewStagingDeployCash) {
return GithubUtils.generateStagingDeployCashBody(
newVersion,
newTag,
_.map(mergedPRs, GithubUtils.getPullRequestURLFromNumber),
);
}

// There is an open StagingDeployCash, so we'll be updating it, not creating a new one
const currentStagingDeployCashData = GithubUtils.getStagingDeployCashData(stagingDeployResponse.data[0]);
console.log('Parsed the following data from the current StagingDeployCash:', currentStagingDeployCashData);
currentStagingDeployCashIssueNumber = currentStagingDeployCashData.number;

const newDeployBlockers = _.map(deployBlockerResponse.data, ({html_url}) => ({
url: html_url,
number: GithubUtils.getIssueOrPullRequestNumberFromURL(html_url),
isResolved: false,
}));

// If we aren't sent a tag, then use the existing tag
const tag = newVersion || currentStagingDeployCashData.tag;
const didVersionChange = newVersion ? newVersion !== currentStagingDeployCashData.tag : false;

// Find the list of PRs merged between the last StagingDeployCash and the new version
const mergedPRs = GitUtils.getPullRequestsMergedBetween(previousStagingDeployCashData.tag, tag);
// eslint-disable-next-line max-len
console.log(`The following PRs have been merged between the previous StagingDeployCash (${previousStagingDeployCashData.tag}) and new version (${tag}):`, mergedPRs);

// Generate the PR list, preserving the previous state of `isVerified` for existing PRs
const PRList = _.sortBy(
_.unique(
Expand Down Expand Up @@ -123,7 +123,7 @@ const run = function () {
);

return GithubUtils.generateStagingDeployCashBody(
tag,
newTag,
_.pluck(PRList, 'url'),
_.pluck(_.where(PRList, {isVerified: true}), 'url'),
_.pluck(_.where(PRList, {isAccessible: true}), 'url'),
Expand Down Expand Up @@ -151,7 +151,7 @@ const run = function () {

return GithubUtils.octokit.issues.update({
...defaultPayload,
issue_number: currentStagingDeployCashIssueNumber,
issue_number: currentStagingDeployCashData.number,
});
})
.then(({data}) => {
Expand Down
Loading

0 comments on commit c994c8d

Please sign in to comment.