Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/gijoe0295/App into gijoe/49093
Browse files Browse the repository at this point in the history
  • Loading branch information
gijoe0295 committed Oct 4, 2024
2 parents 093f361 + b0ef513 commit 365c004
Show file tree
Hide file tree
Showing 512 changed files with 10,642 additions and 5,026 deletions.
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.

2 changes: 1 addition & 1 deletion .github/actions/composite/setupGitForOSBotify/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ runs:
- name: Set up git for OSBotify
shell: bash
run: |
git config user.signingkey 367811D53E34168C
git config user.signingkey AEE1036472A782AB
git config commit.gpgsign true
git config user.name OSBotify
git config user.email [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ runs:
- name: Set up git for OSBotify
shell: bash
run: |
git config user.signingkey 367811D53E34168C
git config user.signingkey AEE1036472A782AB
git config commit.gpgsign true
git config user.name OSBotify
git config user.email [email protected]
Expand Down
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
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 365c004

Please sign in to comment.