Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into feat-Delete-workspa…
Browse files Browse the repository at this point in the history
…ce-with-card-feed
  • Loading branch information
waterim committed Oct 10, 2024
2 parents f41875f + 8f5ba1e commit 4155c32
Show file tree
Hide file tree
Showing 614 changed files with 26,297 additions and 12,334 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ docs/assets/**
web/gtm.js
**/.expo/**
src/libs/SearchParser/searchParser.js
help/_scripts/**
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,5 +291,11 @@ module.exports = {
'rulesdir/use-periods-for-error-messages': 'error',
},
},
{
files: ['*.ts', '*.tsx'],
rules: {
'rulesdir/prefer-at': 'error',
},
},
],
};
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE/Standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ Which of our officially supported platforms is this issue occurring on?

## Screenshots/Videos

Add any screenshot/video evidence
<details>
<summary>Add any screenshot/video evidence</summary>


</details>

[View all open jobs on GitHub](https://github.com/Expensify/App/issues?q=is%3Aopen+is%3Aissue+label%3A%22Help+Wanted%22)
102 changes: 0 additions & 102 deletions .github/actions/composite/buildAndroidE2EAPK/action.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/actions/javascript/authorChecklist/authorChecklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ function partitionWithChecklist(body: string): string[] {
async function getNumberOfItemsFromAuthorChecklist(): Promise<number> {
const response = await fetch(pathToAuthorChecklist);
const fileContents = await response.text();
const checklist = partitionWithChecklist(fileContents)[1];
const numberOfChecklistItems = (checklist.match(/\[ \]/g) ?? []).length;
const checklist = partitionWithChecklist(fileContents).at(1);
const numberOfChecklistItems = (checklist?.match(/\[ \]/g) ?? []).length ?? 0;
return numberOfChecklistItems;
}

Expand Down
18 changes: 11 additions & 7 deletions .github/actions/javascript/authorChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16771,8 +16771,8 @@ function partitionWithChecklist(body) {
async function getNumberOfItemsFromAuthorChecklist() {
const response = await fetch(pathToAuthorChecklist);
const fileContents = await response.text();
const checklist = partitionWithChecklist(fileContents)[1];
const numberOfChecklistItems = (checklist.match(/\[ \]/g) ?? []).length;
const checklist = partitionWithChecklist(fileContents).at(1);
const numberOfChecklistItems = (checklist?.match(/\[ \]/g) ?? []).length ?? 0;
return numberOfChecklistItems;
}
function checkPRForCompletedChecklist(expectedNumberOfChecklistItems, checklist) {
Expand Down Expand Up @@ -17180,7 +17180,11 @@ class GithubUtils {
if (data.length > 1) {
throw new Error(`Found more than one ${CONST_1.default.LABELS.STAGING_DEPLOY} issue.`);
}
return this.getStagingDeployCashData(data[0]);
const issue = data.at(0);
if (!issue) {
throw new Error(`Found an undefined ${CONST_1.default.LABELS.STAGING_DEPLOY} issue.`);
}
return this.getStagingDeployCashData(issue);
});
}
/**
Expand Down Expand Up @@ -17258,7 +17262,7 @@ class GithubUtils {
}
internalQASection = internalQASection[1];
const internalQAPRs = [...internalQASection.matchAll(new RegExp(`- \\[([ x])]\\s(${CONST_1.default.PULL_REQUEST_REGEX.source})`, 'g'))].map((match) => ({
url: match[2].split('-')[0].trim(),
url: match[2].split('-').at(0)?.trim() ?? '',
number: Number.parseInt(match[3], 10),
isResolved: match[1] === 'x',
}));
Expand Down Expand Up @@ -17342,7 +17346,7 @@ class GithubUtils {
* Fetch all pull requests given a list of PR numbers.
*/
static fetchAllPullRequests(pullRequestNumbers) {
const oldestPR = pullRequestNumbers.sort((a, b) => a - b)[0];
const oldestPR = pullRequestNumbers.sort((a, b) => a - b).at(0);
return this.paginate(this.octokit.pulls.list, {
owner: CONST_1.default.GITHUB_OWNER,
repo: CONST_1.default.APP_REPO,
Expand Down Expand Up @@ -17416,7 +17420,7 @@ class GithubUtils {
repo: CONST_1.default.APP_REPO,
workflow_id: workflow,
})
.then((response) => response.data.workflow_runs[0]?.id);
.then((response) => response.data.workflow_runs.at(0)?.id ?? -1);
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
Expand Down Expand Up @@ -17484,7 +17488,7 @@ class GithubUtils {
per_page: 1,
name: artifactName,
})
.then((response) => response.data.artifacts[0]);
.then((response) => response.data.artifacts.at(0));
}
/**
* Given an artifact ID, returns the download URL to a zip file containing the artifact.
Expand Down
14 changes: 9 additions & 5 deletions .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12421,7 +12421,11 @@ class GithubUtils {
if (data.length > 1) {
throw new Error(`Found more than one ${CONST_1.default.LABELS.STAGING_DEPLOY} issue.`);
}
return this.getStagingDeployCashData(data[0]);
const issue = data.at(0);
if (!issue) {
throw new Error(`Found an undefined ${CONST_1.default.LABELS.STAGING_DEPLOY} issue.`);
}
return this.getStagingDeployCashData(issue);
});
}
/**
Expand Down Expand Up @@ -12499,7 +12503,7 @@ class GithubUtils {
}
internalQASection = internalQASection[1];
const internalQAPRs = [...internalQASection.matchAll(new RegExp(`- \\[([ x])]\\s(${CONST_1.default.PULL_REQUEST_REGEX.source})`, 'g'))].map((match) => ({
url: match[2].split('-')[0].trim(),
url: match[2].split('-').at(0)?.trim() ?? '',
number: Number.parseInt(match[3], 10),
isResolved: match[1] === 'x',
}));
Expand Down Expand Up @@ -12583,7 +12587,7 @@ class GithubUtils {
* Fetch all pull requests given a list of PR numbers.
*/
static fetchAllPullRequests(pullRequestNumbers) {
const oldestPR = pullRequestNumbers.sort((a, b) => a - b)[0];
const oldestPR = pullRequestNumbers.sort((a, b) => a - b).at(0);
return this.paginate(this.octokit.pulls.list, {
owner: CONST_1.default.GITHUB_OWNER,
repo: CONST_1.default.APP_REPO,
Expand Down Expand Up @@ -12657,7 +12661,7 @@ class GithubUtils {
repo: CONST_1.default.APP_REPO,
workflow_id: workflow,
})
.then((response) => response.data.workflow_runs[0]?.id);
.then((response) => response.data.workflow_runs.at(0)?.id ?? -1);
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
Expand Down Expand Up @@ -12725,7 +12729,7 @@ class GithubUtils {
per_page: 1,
name: artifactName,
})
.then((response) => response.data.artifacts[0]);
.then((response) => response.data.artifacts.at(0));
}
/**
* Given an artifact ID, returns the download URL to a zip file containing the artifact.
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/bumpVersion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3536,7 +3536,7 @@ exports.updateAndroidVersion = updateAndroidVersion;
* Updates the CFBundleShortVersionString and the CFBundleVersion.
*/
function updateiOSVersion(version) {
const shortVersion = version.split('-')[0];
const shortVersion = version.split('-').at(0);
const cfVersion = version.includes('-') ? version.replace('-', '.') : `${version}.0`;
console.log('Updating iOS', `CFBundleShortVersionString: ${shortVersion}`, `CFBundleVersion: ${cfVersion}`);
// Update Plists
Expand Down
14 changes: 9 additions & 5 deletions .github/actions/javascript/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11704,7 +11704,11 @@ class GithubUtils {
if (data.length > 1) {
throw new Error(`Found more than one ${CONST_1.default.LABELS.STAGING_DEPLOY} issue.`);
}
return this.getStagingDeployCashData(data[0]);
const issue = data.at(0);
if (!issue) {
throw new Error(`Found an undefined ${CONST_1.default.LABELS.STAGING_DEPLOY} issue.`);
}
return this.getStagingDeployCashData(issue);
});
}
/**
Expand Down Expand Up @@ -11782,7 +11786,7 @@ class GithubUtils {
}
internalQASection = internalQASection[1];
const internalQAPRs = [...internalQASection.matchAll(new RegExp(`- \\[([ x])]\\s(${CONST_1.default.PULL_REQUEST_REGEX.source})`, 'g'))].map((match) => ({
url: match[2].split('-')[0].trim(),
url: match[2].split('-').at(0)?.trim() ?? '',
number: Number.parseInt(match[3], 10),
isResolved: match[1] === 'x',
}));
Expand Down Expand Up @@ -11866,7 +11870,7 @@ class GithubUtils {
* Fetch all pull requests given a list of PR numbers.
*/
static fetchAllPullRequests(pullRequestNumbers) {
const oldestPR = pullRequestNumbers.sort((a, b) => a - b)[0];
const oldestPR = pullRequestNumbers.sort((a, b) => a - b).at(0);
return this.paginate(this.octokit.pulls.list, {
owner: CONST_1.default.GITHUB_OWNER,
repo: CONST_1.default.APP_REPO,
Expand Down Expand Up @@ -11940,7 +11944,7 @@ class GithubUtils {
repo: CONST_1.default.APP_REPO,
workflow_id: workflow,
})
.then((response) => response.data.workflow_runs[0]?.id);
.then((response) => response.data.workflow_runs.at(0)?.id ?? -1);
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
Expand Down Expand Up @@ -12008,7 +12012,7 @@ class GithubUtils {
per_page: 1,
name: artifactName,
})
.then((response) => response.data.artifacts[0]);
.then((response) => response.data.artifacts.at(0));
}
/**
* Given an artifact ID, returns the download URL to a zip file containing the artifact.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as core from '@actions/core';
import format from 'date-fns/format';
import {format} from 'date-fns/format';
import fs from 'fs';
import CONST from '@github/libs/CONST';
import GithubUtils from '@github/libs/GithubUtils';
Expand Down Expand Up @@ -29,15 +29,24 @@ async function run(): Promise<IssuesCreateResponse | void> {

// 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.
const mostRecentChecklist = recentDeployChecklists[0];
const mostRecentChecklist = recentDeployChecklists.at(0);

if (!mostRecentChecklist) {
throw new Error('Could not find the most recent checklist');
}

const shouldCreateNewDeployChecklist = mostRecentChecklist.state !== 'open';
const previousChecklist = shouldCreateNewDeployChecklist ? mostRecentChecklist : recentDeployChecklists[1];
const previousChecklist = shouldCreateNewDeployChecklist ? mostRecentChecklist : recentDeployChecklists.at(1);
if (shouldCreateNewDeployChecklist) {
console.log('Latest StagingDeployCash is closed, creating a new one.', mostRecentChecklist);
} else {
console.log('Latest StagingDeployCash is open, updating it instead of creating a new one.', 'Current:', mostRecentChecklist, 'Previous:', previousChecklist);
}

if (!previousChecklist) {
throw new Error('Could not find the previous checklist');
}

// Parse the data from the previous and current checklists into the format used to generate the checklist
const previousChecklistData = GithubUtils.getStagingDeployCashData(previousChecklist);
const currentChecklistData: StagingDeployCashData | undefined = shouldCreateNewDeployChecklist ? undefined : GithubUtils.getStagingDeployCashData(mostRecentChecklist);
Expand Down
Loading

0 comments on commit 4155c32

Please sign in to comment.