Skip to content

Commit 94ddc07

Browse files
committed
Merge remote-tracking branch 'e.cash/main' into kidroca/attachment-picker-briefly-displayed-after-taking-a-picture
# Conflicts: # src/components/AttachmentPicker/index.native.js
2 parents 6964c60 + d792202 commit 94ddc07

File tree

137 files changed

+16733
-1183
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+16733
-1183
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
EXPENSIFY_URL_CASH=https://expensify.cash/
2+
EXPENSIFY_URL_SECURE=https://secure.expensify.com.dev/
23
EXPENSIFY_URL_COM=https://www.expensify.com.dev/
34
EXPENSIFY_PARTNER_NAME=chat-expensify-com
45
EXPENSIFY_PARTNER_PASSWORD=e21965746fd75f82bb66

.env.production

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
EXPENSIFY_URL_CASH=https://expensify.cash/
2+
EXPENSIFY_URL_SECURE=https://secure.expensify.com/
23
EXPENSIFY_URL_COM=https://www.expensify.com/
34
EXPENSIFY_PARTNER_NAME=chat-expensify-com
45
EXPENSIFY_PARTNER_PASSWORD=e21965746fd75f82bb66

.env.staging

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
EXPENSIFY_URL_CASH=https://staging.expensify.cash/
2+
EXPENSIFY_URL_SECURE=https://staging-secure.expensify.com/
23
EXPENSIFY_URL_COM=https://www.expensify.com/
34
EXPENSIFY_PARTNER_NAME=chat-expensify-com
45
EXPENSIFY_PARTNER_PASSWORD=e21965746fd75f82bb66

.github/ISSUE_TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
labels: AutoAssignerTriage
3+
---
4+
15
If you haven’t already, check out our [contributing guidelines](https://github.com/Expensify/ReactNativeChat/blob/main/CONTRIBUTING.md) for onboarding and email [email protected] to request to join our Slack channel!
26
___
37

.github/actions/checkDeployBlockers/index.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,13 @@ class GithubUtils {
172172
* @returns {Array<Object>} - [{url: String, number: Number, isVerified: Boolean}]
173173
*/
174174
getStagingDeployCashPRList(issue) {
175-
const PRListSection = issue.body.match(/pull requests:\*\*\r\n((?:.*\r\n)+)\r\n/)[1];
175+
let PRListSection = issue.body.match(/pull requests:\*\*\r?\n((?:.*\r?\n)+)\r?\n/) || [];
176+
if (PRListSection.length !== 2) {
177+
// No PRs, return an empty array
178+
console.log('Hmmm...The open StagingDeployCash does not list any pull requests, continuing...');
179+
return [];
180+
}
181+
PRListSection = PRListSection[1];
176182
const unverifiedPRs = _.map(
177183
[...PRListSection.matchAll(new RegExp(`- \\[ ] (${PULL_REQUEST_REGEX.source})`, 'g'))],
178184
match => ({
@@ -204,7 +210,7 @@ class GithubUtils {
204210
* @returns {Array<Object>} - [{URL: String, number: Number, isResolved: Boolean}]
205211
*/
206212
getStagingDeployCashDeployBlockers(issue) {
207-
let deployBlockerSection = issue.body.match(/Deploy Blockers:\*\*\r\n((?:.*\r\n)+)/) || [];
213+
let deployBlockerSection = issue.body.match(/Deploy Blockers:\*\*\r?\n((?:.*\r?\n)+)/) || [];
208214
if (deployBlockerSection.length !== 2) {
209215
return [];
210216
}
@@ -396,6 +402,22 @@ class GithubUtils {
396402
});
397403
}
398404

405+
/**
406+
* Get the most recent workflow run for the given Expensify.cash workflow.
407+
*
408+
* @param {String} workflow
409+
* @returns {Promise}
410+
*/
411+
getLatestWorkflowRunID(workflow) {
412+
console.log(`Fetching Expensify.cash workflow runs for ${workflow}...`);
413+
return this.octokit.actions.listWorkflowRuns({
414+
owner: GITHUB_OWNER,
415+
repo: EXPENSIFY_CASH_REPO,
416+
workflow_id: workflow,
417+
})
418+
.then(response => lodashGet(response, 'data.workflow_runs[0].id'));
419+
}
420+
399421
/**
400422
* Generate the well-formatted body of a production release.
401423
*

.github/actions/createOrUpdateStagingDeploy/index.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,13 @@ class GithubUtils {
198198
* @returns {Array<Object>} - [{url: String, number: Number, isVerified: Boolean}]
199199
*/
200200
getStagingDeployCashPRList(issue) {
201-
const PRListSection = issue.body.match(/pull requests:\*\*\r\n((?:.*\r\n)+)\r\n/)[1];
201+
let PRListSection = issue.body.match(/pull requests:\*\*\r?\n((?:.*\r?\n)+)\r?\n/) || [];
202+
if (PRListSection.length !== 2) {
203+
// No PRs, return an empty array
204+
console.log('Hmmm...The open StagingDeployCash does not list any pull requests, continuing...');
205+
return [];
206+
}
207+
PRListSection = PRListSection[1];
202208
const unverifiedPRs = _.map(
203209
[...PRListSection.matchAll(new RegExp(`- \\[ ] (${PULL_REQUEST_REGEX.source})`, 'g'))],
204210
match => ({
@@ -230,7 +236,7 @@ class GithubUtils {
230236
* @returns {Array<Object>} - [{URL: String, number: Number, isResolved: Boolean}]
231237
*/
232238
getStagingDeployCashDeployBlockers(issue) {
233-
let deployBlockerSection = issue.body.match(/Deploy Blockers:\*\*\r\n((?:.*\r\n)+)/) || [];
239+
let deployBlockerSection = issue.body.match(/Deploy Blockers:\*\*\r?\n((?:.*\r?\n)+)/) || [];
234240
if (deployBlockerSection.length !== 2) {
235241
return [];
236242
}
@@ -422,6 +428,22 @@ class GithubUtils {
422428
});
423429
}
424430

431+
/**
432+
* Get the most recent workflow run for the given Expensify.cash workflow.
433+
*
434+
* @param {String} workflow
435+
* @returns {Promise}
436+
*/
437+
getLatestWorkflowRunID(workflow) {
438+
console.log(`Fetching Expensify.cash workflow runs for ${workflow}...`);
439+
return this.octokit.actions.listWorkflowRuns({
440+
owner: GITHUB_OWNER,
441+
repo: EXPENSIFY_CASH_REPO,
442+
workflow_id: workflow,
443+
})
444+
.then(response => lodashGet(response, 'data.workflow_runs[0].id'));
445+
}
446+
425447
/**
426448
* Generate the well-formatted body of a production release.
427449
*

.github/actions/getDeployPullRequestList/getDeployPullRequestList.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
const _ = require('underscore');
22
const core = require('@actions/core');
33
const github = require('@actions/github');
4+
const ActionUtils = require('../../libs/ActionUtils');
45
const GitUtils = require('../../libs/GitUtils');
56

67
const octokit = github.getOctokit(core.getInput('GITHUB_TOKEN', {required: true}));
78
const inputTag = core.getInput('TAG', {required: true});
89

9-
const isProductionDeploy = JSON.parse(core.getInput('IS_PRODUCTION_DEPLOY', {required: false}));
10+
const isProductionDeploy = ActionUtils.getJSONInput('IS_PRODUCTION_DEPLOY', {required: false}, false);
1011
const itemToFetch = isProductionDeploy ? 'release' : 'tag';
1112

1213
/**

.github/actions/getDeployPullRequestList/index.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ module.exports =
1111
const _ = __nccwpck_require__(4987);
1212
const core = __nccwpck_require__(2186);
1313
const github = __nccwpck_require__(5438);
14+
const ActionUtils = __nccwpck_require__(970);
1415
const GitUtils = __nccwpck_require__(669);
1516

1617
const octokit = github.getOctokit(core.getInput('GITHUB_TOKEN', {required: true}));
1718
const inputTag = core.getInput('TAG', {required: true});
1819

19-
const isProductionDeploy = JSON.parse(core.getInput('IS_PRODUCTION_DEPLOY', {required: false}));
20+
const isProductionDeploy = ActionUtils.getJSONInput('IS_PRODUCTION_DEPLOY', {required: false}, false);
2021
const itemToFetch = isProductionDeploy ? 'release' : 'tag';
2122

2223
/**
@@ -73,6 +74,35 @@ getTagsOrReleases(isProductionDeploy)
7374
.catch(error => core.setFailed(error));
7475

7576

77+
/***/ }),
78+
79+
/***/ 970:
80+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
81+
82+
const core = __nccwpck_require__(2186);
83+
84+
/**
85+
* Safely parse a JSON input to a GitHub Action.
86+
*
87+
* @param {String} name - The name of the input.
88+
* @param {Object} options - Options to pass to core.getInput
89+
* @param {*} [defaultValue] - A default value to provide for the input.
90+
* Not required if the {required: true} option is given in the second arg to this function.
91+
* @returns {any}
92+
*/
93+
function getJSONInput(name, options, defaultValue = undefined) {
94+
const input = core.getInput(name, options);
95+
if (input) {
96+
return JSON.parse(input);
97+
}
98+
return defaultValue;
99+
}
100+
101+
module.exports = {
102+
getJSONInput,
103+
};
104+
105+
76106
/***/ }),
77107

78108
/***/ 669:

.github/actions/getReleaseBody/getReleaseBody.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
const _ = require('underscore');
22
const core = require('@actions/core');
3+
const ActionUtils = require('../../libs/ActionUtils');
34
const GithubUtils = require('../../libs/GithubUtils');
45

56
// Parse the stringified JSON array of PR numbers, and cast each from String -> Number
6-
const PRList = _.map(JSON.parse(core.getInput('PR_LIST', {required: true})), Number);
7+
const PRList = _.map(ActionUtils.getJSONInput('PR_LIST', {required: true}), Number);
78
console.log(`Got PR list: ${PRList}`);
89

910
const releaseBody = GithubUtils.getReleaseBody(PRList);

.github/actions/getReleaseBody/index.js

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ module.exports =
1010

1111
const _ = __nccwpck_require__(4987);
1212
const core = __nccwpck_require__(2186);
13+
const ActionUtils = __nccwpck_require__(970);
1314
const GithubUtils = __nccwpck_require__(7999);
1415

1516
// Parse the stringified JSON array of PR numbers, and cast each from String -> Number
16-
const PRList = _.map(JSON.parse(core.getInput('PR_LIST', {required: true})), Number);
17+
const PRList = _.map(ActionUtils.getJSONInput('PR_LIST', {required: true}), Number);
1718
console.log(`Got PR list: ${PRList}`);
1819

1920
const releaseBody = GithubUtils.getReleaseBody(PRList);
@@ -22,6 +23,35 @@ console.log(`Generated release body: ${releaseBody}`);
2223
core.setOutput('RELEASE_BODY', releaseBody);
2324

2425

26+
/***/ }),
27+
28+
/***/ 970:
29+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
30+
31+
const core = __nccwpck_require__(2186);
32+
33+
/**
34+
* Safely parse a JSON input to a GitHub Action.
35+
*
36+
* @param {String} name - The name of the input.
37+
* @param {Object} options - Options to pass to core.getInput
38+
* @param {*} [defaultValue] - A default value to provide for the input.
39+
* Not required if the {required: true} option is given in the second arg to this function.
40+
* @returns {any}
41+
*/
42+
function getJSONInput(name, options, defaultValue = undefined) {
43+
const input = core.getInput(name, options);
44+
if (input) {
45+
return JSON.parse(input);
46+
}
47+
return defaultValue;
48+
}
49+
50+
module.exports = {
51+
getJSONInput,
52+
};
53+
54+
2555
/***/ }),
2656

2757
/***/ 7999:
@@ -111,7 +141,13 @@ class GithubUtils {
111141
* @returns {Array<Object>} - [{url: String, number: Number, isVerified: Boolean}]
112142
*/
113143
getStagingDeployCashPRList(issue) {
114-
const PRListSection = issue.body.match(/pull requests:\*\*\r\n((?:.*\r\n)+)\r\n/)[1];
144+
let PRListSection = issue.body.match(/pull requests:\*\*\r?\n((?:.*\r?\n)+)\r?\n/) || [];
145+
if (PRListSection.length !== 2) {
146+
// No PRs, return an empty array
147+
console.log('Hmmm...The open StagingDeployCash does not list any pull requests, continuing...');
148+
return [];
149+
}
150+
PRListSection = PRListSection[1];
115151
const unverifiedPRs = _.map(
116152
[...PRListSection.matchAll(new RegExp(`- \\[ ] (${PULL_REQUEST_REGEX.source})`, 'g'))],
117153
match => ({
@@ -143,7 +179,7 @@ class GithubUtils {
143179
* @returns {Array<Object>} - [{URL: String, number: Number, isResolved: Boolean}]
144180
*/
145181
getStagingDeployCashDeployBlockers(issue) {
146-
let deployBlockerSection = issue.body.match(/Deploy Blockers:\*\*\r\n((?:.*\r\n)+)/) || [];
182+
let deployBlockerSection = issue.body.match(/Deploy Blockers:\*\*\r?\n((?:.*\r?\n)+)/) || [];
147183
if (deployBlockerSection.length !== 2) {
148184
return [];
149185
}
@@ -335,6 +371,22 @@ class GithubUtils {
335371
});
336372
}
337373

374+
/**
375+
* Get the most recent workflow run for the given Expensify.cash workflow.
376+
*
377+
* @param {String} workflow
378+
* @returns {Promise}
379+
*/
380+
getLatestWorkflowRunID(workflow) {
381+
console.log(`Fetching Expensify.cash workflow runs for ${workflow}...`);
382+
return this.octokit.actions.listWorkflowRuns({
383+
owner: GITHUB_OWNER,
384+
repo: EXPENSIFY_CASH_REPO,
385+
workflow_id: workflow,
386+
})
387+
.then(response => lodashGet(response, 'data.workflow_runs[0].id'));
388+
}
389+
338390
/**
339391
* Generate the well-formatted body of a production release.
340392
*

.github/actions/isPullRequestMergeable/index.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,13 @@ class GithubUtils {
146146
* @returns {Array<Object>} - [{url: String, number: Number, isVerified: Boolean}]
147147
*/
148148
getStagingDeployCashPRList(issue) {
149-
const PRListSection = issue.body.match(/pull requests:\*\*\r\n((?:.*\r\n)+)\r\n/)[1];
149+
let PRListSection = issue.body.match(/pull requests:\*\*\r?\n((?:.*\r?\n)+)\r?\n/) || [];
150+
if (PRListSection.length !== 2) {
151+
// No PRs, return an empty array
152+
console.log('Hmmm...The open StagingDeployCash does not list any pull requests, continuing...');
153+
return [];
154+
}
155+
PRListSection = PRListSection[1];
150156
const unverifiedPRs = _.map(
151157
[...PRListSection.matchAll(new RegExp(`- \\[ ] (${PULL_REQUEST_REGEX.source})`, 'g'))],
152158
match => ({
@@ -178,7 +184,7 @@ class GithubUtils {
178184
* @returns {Array<Object>} - [{URL: String, number: Number, isResolved: Boolean}]
179185
*/
180186
getStagingDeployCashDeployBlockers(issue) {
181-
let deployBlockerSection = issue.body.match(/Deploy Blockers:\*\*\r\n((?:.*\r\n)+)/) || [];
187+
let deployBlockerSection = issue.body.match(/Deploy Blockers:\*\*\r?\n((?:.*\r?\n)+)/) || [];
182188
if (deployBlockerSection.length !== 2) {
183189
return [];
184190
}
@@ -370,6 +376,22 @@ class GithubUtils {
370376
});
371377
}
372378

379+
/**
380+
* Get the most recent workflow run for the given Expensify.cash workflow.
381+
*
382+
* @param {String} workflow
383+
* @returns {Promise}
384+
*/
385+
getLatestWorkflowRunID(workflow) {
386+
console.log(`Fetching Expensify.cash workflow runs for ${workflow}...`);
387+
return this.octokit.actions.listWorkflowRuns({
388+
owner: GITHUB_OWNER,
389+
repo: EXPENSIFY_CASH_REPO,
390+
workflow_id: workflow,
391+
})
392+
.then(response => lodashGet(response, 'data.workflow_runs[0].id'));
393+
}
394+
373395
/**
374396
* Generate the well-formatted body of a production release.
375397
*

.github/actions/isStagingDeployLocked/index.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,13 @@ class GithubUtils {
124124
* @returns {Array<Object>} - [{url: String, number: Number, isVerified: Boolean}]
125125
*/
126126
getStagingDeployCashPRList(issue) {
127-
const PRListSection = issue.body.match(/pull requests:\*\*\r\n((?:.*\r\n)+)\r\n/)[1];
127+
let PRListSection = issue.body.match(/pull requests:\*\*\r?\n((?:.*\r?\n)+)\r?\n/) || [];
128+
if (PRListSection.length !== 2) {
129+
// No PRs, return an empty array
130+
console.log('Hmmm...The open StagingDeployCash does not list any pull requests, continuing...');
131+
return [];
132+
}
133+
PRListSection = PRListSection[1];
128134
const unverifiedPRs = _.map(
129135
[...PRListSection.matchAll(new RegExp(`- \\[ ] (${PULL_REQUEST_REGEX.source})`, 'g'))],
130136
match => ({
@@ -156,7 +162,7 @@ class GithubUtils {
156162
* @returns {Array<Object>} - [{URL: String, number: Number, isResolved: Boolean}]
157163
*/
158164
getStagingDeployCashDeployBlockers(issue) {
159-
let deployBlockerSection = issue.body.match(/Deploy Blockers:\*\*\r\n((?:.*\r\n)+)/) || [];
165+
let deployBlockerSection = issue.body.match(/Deploy Blockers:\*\*\r?\n((?:.*\r?\n)+)/) || [];
160166
if (deployBlockerSection.length !== 2) {
161167
return [];
162168
}
@@ -348,6 +354,22 @@ class GithubUtils {
348354
});
349355
}
350356

357+
/**
358+
* Get the most recent workflow run for the given Expensify.cash workflow.
359+
*
360+
* @param {String} workflow
361+
* @returns {Promise}
362+
*/
363+
getLatestWorkflowRunID(workflow) {
364+
console.log(`Fetching Expensify.cash workflow runs for ${workflow}...`);
365+
return this.octokit.actions.listWorkflowRuns({
366+
owner: GITHUB_OWNER,
367+
repo: EXPENSIFY_CASH_REPO,
368+
workflow_id: workflow,
369+
})
370+
.then(response => lodashGet(response, 'data.workflow_runs[0].id'));
371+
}
372+
351373
/**
352374
* Generate the well-formatted body of a production release.
353375
*

0 commit comments

Comments
 (0)