Skip to content

Commit 491a3ce

Browse files
Merge branch 'main' into bfitzexpensify-patch-10
2 parents 2c9d151 + 4a27ad0 commit 491a3ce

329 files changed

Lines changed: 7079 additions & 4241 deletions

File tree

Some content is hidden

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

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ EXPENSIFY_ACCOUNT_ID_MANAGER_MCTEST=-1
3636
FB_API_KEY=YOUR_API_KEY
3737
FB_APP_ID=YOUR_APP_ID
3838
FB_PROJECT_ID=YOUR_PROJECT_ID
39+
40+
GITHUB_TOKEN=YOUR_TOKEN

.github/actions/javascript/postTestBuildComment/action.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ inputs:
44
REPO:
55
description: "Repository to place a comment. Can be App or Mobile-Expensify"
66
default: App
7-
PR_NUMBER:
8-
description: "Pull request number"
9-
required: true
7+
APP_PR_NUMBER:
8+
description: "Pull request number for Expensify/App repository"
9+
required: false
10+
MOBILE_EXPENSIFY_PR_NUMBER:
11+
description: "Pull request number for Expensify/Mobile-Expensify repository"
12+
required: false
1013
GITHUB_TOKEN:
1114
description: "Github token for authentication"
1215
default: "${{ github.token }}"

.github/actions/javascript/postTestBuildComment/index.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11501,7 +11501,7 @@ const core = __importStar(__nccwpck_require__(2186));
1150111501
const github_1 = __nccwpck_require__(5438);
1150211502
const CONST_1 = __importDefault(__nccwpck_require__(9873));
1150311503
const GithubUtils_1 = __importDefault(__nccwpck_require__(9296));
11504-
function getTestBuildMessage() {
11504+
function getTestBuildMessage(appPr, mobileExpensifyPr) {
1150511505
const inputs = ['ANDROID', 'DESKTOP', 'IOS', 'WEB'];
1150611506
const names = {
1150711507
[inputs[0]]: 'Android',
@@ -11526,16 +11526,18 @@ function getTestBuildMessage() {
1152611526
};
1152711527
return acc;
1152811528
}, {});
11529-
const message = `:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube:
11529+
const message = `:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS${appPr ? ', Desktop, and Web' : ''}. Happy testing! :test_tube::test_tube:
11530+
Built from${appPr ? ` App PR Expensify/App#${appPr}` : ''}${mobileExpensifyPr ? ` Mobile-Expensify PR Expensify/Mobile-Expensify#${mobileExpensifyPr}` : ''}.
1153011531
| Android :robot: | iOS :apple: |
1153111532
| ------------- | ------------- |
11532-
| Android :robot::arrows_counterclockwise: | iOS :apple::arrows_counterclockwise: |
1153311533
| ${result.ANDROID.link} | ${result.IOS.link} |
1153411534
| ${result.ANDROID.qrCode} | ${result.IOS.qrCode} |
11535-
| Desktop :computer: | Web :spider_web: |
11535+
${appPr
11536+
? `\n| Desktop :computer: | Web :spider_web: |
11537+
| ------------- | ------------- |
1153611538
| ${result.DESKTOP.link} | ${result.WEB.link} |
11537-
| ${result.DESKTOP.qrCode} | ${result.WEB.qrCode} |
11538-
11539+
| ${result.DESKTOP.qrCode} | ${result.WEB.qrCode} |\n`
11540+
: ''}
1153911541
---
1154011542

1154111543
:eyes: [View the workflow run that generated this build](https://github.com/${github_1.context.repo.owner}/${github_1.context.repo.repo}/actions/runs/${github_1.context.runId}) :eyes:
@@ -11557,17 +11559,23 @@ async function commentPR(REPO, PR, message) {
1155711559
}
1155811560
}
1155911561
async function run() {
11560-
const PR_NUMBER = Number(core.getInput('PR_NUMBER', { required: true }));
11562+
const APP_PR_NUMBER = Number(core.getInput('APP_PR_NUMBER', { required: false }));
11563+
const MOBILE_EXPENSIFY_PR_NUMBER = Number(core.getInput('MOBILE_EXPENSIFY_PR_NUMBER', { required: false }));
1156111564
const REPO = String(core.getInput('REPO', { required: true }));
1156211565
if (REPO !== CONST_1.default.APP_REPO && REPO !== CONST_1.default.MOBILE_EXPENSIFY_REPO) {
1156311566
core.setFailed(`Invalid repository used to place output comment: ${REPO}`);
1156411567
return;
1156511568
}
11569+
if ((REPO === CONST_1.default.APP_REPO && !APP_PR_NUMBER) || (REPO === CONST_1.default.MOBILE_EXPENSIFY_REPO && !MOBILE_EXPENSIFY_PR_NUMBER)) {
11570+
core.setFailed(`Please provide ${REPO} pull request number`);
11571+
return;
11572+
}
11573+
const destinationPRNumber = REPO === CONST_1.default.APP_REPO ? APP_PR_NUMBER : MOBILE_EXPENSIFY_PR_NUMBER;
1156611574
const comments = await GithubUtils_1.default.paginate(GithubUtils_1.default.octokit.issues.listComments, {
1156711575
owner: CONST_1.default.GITHUB_OWNER,
1156811576
repo: REPO,
1156911577
// eslint-disable-next-line @typescript-eslint/naming-convention
11570-
issue_number: PR_NUMBER,
11578+
issue_number: destinationPRNumber,
1157111579
// eslint-disable-next-line @typescript-eslint/naming-convention
1157211580
per_page: 100,
1157311581
}, (response) => response.data);
@@ -11584,7 +11592,7 @@ async function run() {
1158411592
}
1158511593
`);
1158611594
}
11587-
await commentPR(REPO, PR_NUMBER, getTestBuildMessage());
11595+
await commentPR(REPO, destinationPRNumber, getTestBuildMessage(APP_PR_NUMBER, MOBILE_EXPENSIFY_PR_NUMBER));
1158811596
}
1158911597
if (require.main === require.cache[eval('__filename')]) {
1159011598
run();

.github/actions/javascript/postTestBuildComment/postTestBuildComment.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {TupleToUnion} from 'type-fest';
44
import CONST from '@github/libs/CONST';
55
import GithubUtils from '@github/libs/GithubUtils';
66

7-
function getTestBuildMessage(): string {
7+
function getTestBuildMessage(appPr?: number, mobileExpensifyPr?: number): string {
88
const inputs = ['ANDROID', 'DESKTOP', 'IOS', 'WEB'] as const;
99
const names = {
1010
[inputs[0]]: 'Android',
@@ -38,16 +38,20 @@ function getTestBuildMessage(): string {
3838
{} as Record<TupleToUnion<typeof inputs>, {link: string; qrCode: string}>,
3939
);
4040

41-
const message = `:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube:
41+
const message = `:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS${appPr ? ', Desktop, and Web' : ''}. Happy testing! :test_tube::test_tube:
42+
Built from${appPr ? ` App PR Expensify/App#${appPr}` : ''}${mobileExpensifyPr ? ` Mobile-Expensify PR Expensify/Mobile-Expensify#${mobileExpensifyPr}` : ''}.
4243
| Android :robot: | iOS :apple: |
4344
| ------------- | ------------- |
44-
| Android :robot::arrows_counterclockwise: | iOS :apple::arrows_counterclockwise: |
4545
| ${result.ANDROID.link} | ${result.IOS.link} |
4646
| ${result.ANDROID.qrCode} | ${result.IOS.qrCode} |
47-
| Desktop :computer: | Web :spider_web: |
47+
${
48+
appPr
49+
? `\n| Desktop :computer: | Web :spider_web: |
50+
| ------------- | ------------- |
4851
| ${result.DESKTOP.link} | ${result.WEB.link} |
49-
| ${result.DESKTOP.qrCode} | ${result.WEB.qrCode} |
50-
52+
| ${result.DESKTOP.qrCode} | ${result.WEB.qrCode} |\n`
53+
: ''
54+
}
5155
---
5256
5357
:eyes: [View the workflow run that generated this build](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) :eyes:
@@ -72,21 +76,28 @@ async function commentPR(REPO: string, PR: number, message: string) {
7276
}
7377

7478
async function run() {
75-
const PR_NUMBER = Number(core.getInput('PR_NUMBER', {required: true}));
79+
const APP_PR_NUMBER = Number(core.getInput('APP_PR_NUMBER', {required: false}));
80+
const MOBILE_EXPENSIFY_PR_NUMBER = Number(core.getInput('MOBILE_EXPENSIFY_PR_NUMBER', {required: false}));
7681
const REPO = String(core.getInput('REPO', {required: true}));
7782

7883
if (REPO !== CONST.APP_REPO && REPO !== CONST.MOBILE_EXPENSIFY_REPO) {
7984
core.setFailed(`Invalid repository used to place output comment: ${REPO}`);
8085
return;
8186
}
8287

88+
if ((REPO === CONST.APP_REPO && !APP_PR_NUMBER) || (REPO === CONST.MOBILE_EXPENSIFY_REPO && !MOBILE_EXPENSIFY_PR_NUMBER)) {
89+
core.setFailed(`Please provide ${REPO} pull request number`);
90+
return;
91+
}
92+
93+
const destinationPRNumber = REPO === CONST.APP_REPO ? APP_PR_NUMBER : MOBILE_EXPENSIFY_PR_NUMBER;
8394
const comments = await GithubUtils.paginate(
8495
GithubUtils.octokit.issues.listComments,
8596
{
8697
owner: CONST.GITHUB_OWNER,
8798
repo: REPO,
8899
// eslint-disable-next-line @typescript-eslint/naming-convention
89-
issue_number: PR_NUMBER,
100+
issue_number: destinationPRNumber,
90101
// eslint-disable-next-line @typescript-eslint/naming-convention
91102
per_page: 100,
92103
},
@@ -105,7 +116,7 @@ async function run() {
105116
}
106117
`);
107118
}
108-
await commentPR(REPO, PR_NUMBER, getTestBuildMessage());
119+
await commentPR(REPO, destinationPRNumber, getTestBuildMessage(APP_PR_NUMBER, MOBILE_EXPENSIFY_PR_NUMBER));
109120
}
110121

111122
if (require.main === module) {

.github/scripts/getNewPatchedRNVersion.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ PACKAGE_VERSIONS="$(gh api "/orgs/Expensify/packages/maven/com.expensify.${PACKA
2121
PACKAGE_VERSIONS="$(echo "$PACKAGE_VERSIONS" | grep "$VERSION")"
2222

2323
# Grab the highest patch version from there
24-
LATEST_PATCHED_VERSION="$(echo "$PACKAGE_VERSIONS" | sort | tail -n1)"
24+
LATEST_PATCHED_VERSION="$(echo "$PACKAGE_VERSIONS" | sort -V | tail -n1)"
2525

2626
if [[ -n "$LATEST_PATCHED_VERSION" ]]; then
2727
PATCH_ITERATION=${LATEST_PATCHED_VERSION##*-}

.github/scripts/validateActionsAndWorkflows.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title 'Validating the Github Actions and workflows using the json schemas provid
77
function downloadSchema {
88
[[ $1 = 'github-action.json' ]] && SCHEMA_NAME='GitHub Action' || SCHEMA_NAME='GitHub Workflow'
99
info "Downloading $SCHEMA_NAME schema..."
10-
if curl "https://json.schemastore.org/$1" --output "./tempSchemas/$1" --silent; then
10+
if curl "https://raw.githubusercontent.com/SchemaStore/schemastore/refs/heads/master/src/schemas/json/$1" --output "./tempSchemas/$1" --silent; then
1111
success "Successfully downloaded $SCHEMA_NAME schema!"
1212
else
1313
error "Failed downloading $SCHEMA_NAME schema"

.github/workflows/cherryPick.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ jobs:
3434
uses: ./.github/workflows/createNewVersion.yml
3535
secrets: inherit
3636
with:
37-
# In order to submit a new build for production review, it must have a higher PATCH version than the previously-submitted build
38-
SEMVER_LEVEL: ${{ inputs.TARGET == 'staging' && 'BUILD' || 'PATCH' }}
37+
# In order to submit a new build for production review, it must have a higher PATCH version than the previously-submitted build.
38+
# The typical case is that with each staging deploy, we bump the BUILD version, and with each prod deploy we bump the PATCH version.
39+
# However, if PULL_REQUEST_URL is empty, we assume we want to do a PATCH version bump.
40+
# The reason we assume that is because the use-case for a no-PR CP is after a CP to Production.
41+
# In that case, we need to bump the staging version to be higher than prod.
42+
# We use a patch version so that there's a diff in both `CFBundleVersion` and `CFBundleShortVersion` on iOS,
43+
# so that when we later CP that version bump to staging, the `CFBundleShortVersion` diff is picked up as well.
44+
SEMVER_LEVEL: ${{ (inputs.TARGET == 'production' || inputs.PULL_REQUEST_URL == '') && 'PATCH' || 'BUILD' }}
3945

4046
cherryPick:
4147
needs: createNewVersion
@@ -231,7 +237,7 @@ jobs:
231237
gh pr create \
232238
--title "🍒 Cherry pick PR #${{ steps.getPRInfo.outputs.PR_NUMBER }} to ${{ inputs.TARGET }} 🍒" \
233239
--body "$PR_DESCRIPTION" \
234-
--label "Engineering,Hourly" \
240+
--label "Engineering,Hourly,${{ inputs.TARGET == 'staging' && 'CP Staging' || 'CP Production' }}" \
235241
--base "${{ inputs.TARGET }}"
236242
sleep 5
237243
env:

.github/workflows/cspell.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: 🧙 Check spell
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
branches: [main]
7+
8+
jobs:
9+
spellcheck:
10+
runs-on: ubuntu-latest
11+
name: 🔍 spellcheck
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: streetsidesoftware/cspell-action@v6
15+
with:
16+
files: "**/*"
17+
root: "."
18+
config: "./cspell.json"
19+
inline: error
20+
strict: true
21+
use_cspell_files: false
22+
incremental_files_only: true

.github/workflows/lint-changed.yml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,47 @@ jobs:
1717
if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }}
1818
runs-on: ubuntu-latest
1919
steps:
20+
- name: Count commits between merge base and HEAD
21+
id: count
22+
run: |
23+
# Compare the base commit and HEAD to get the count of commits after base
24+
# up to and including HEAD. Add 2 to this total when fetching history.
25+
#
26+
# When opening a PR, GitHub will create a merge commit that squashes
27+
# your changes for use in the workflow. So your history locally
28+
# may look like
29+
# o---o---o---B - development
30+
# /
31+
# ---o---1---C---o---o---A - main
32+
# Note that the `1` is the merge-base of development and main. The
33+
# number of commits after `1` upto and including `A` is 4.
34+
# In the workflow, GitHub squashs development, so it becomes:
35+
# ---o---1---C---o---o---A - main
36+
# \--M - PR branch
37+
# Where `M`` is the new squashed commit. To fetch enough history to
38+
# include the merge base, we need to fetch `M`, `A` through `C` and
39+
# `1` for total of 4+2=6 commits. The +2 commits accounts for the
40+
# base `1` and merge commit `M`.
41+
RAW_COUNT="$(gh api "repos/$REPO/compare/${BASE}...main" | jq -r '.total_commits')"
42+
ADJUSTED_COUNT=$((RAW_COUNT + 2))
43+
echo "count=$ADJUSTED_COUNT" >> "$GITHUB_OUTPUT"
44+
env:
45+
GH_TOKEN: ${{ github.token }}
46+
BASE: ${{ github.event.pull_request.base.sha }}
47+
REPO: ${{ github.repository }}
48+
2049
- name: Checkout
2150
# v4
2251
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
52+
with:
53+
fetch-depth: ${{ fromJSON(steps.count.outputs.count) }}
2354

2455
- name: Setup Node
2556
uses: ./.github/actions/composite/setupNode
2657
with:
2758
IS_DESKTOP_BUILD: true
28-
59+
2960
- name: Run ESLint to check for deprecation warnings
3061
run: |
31-
# This will just fetch the latest commit from main
32-
git fetch origin main --no-tags --depth=1
33-
3462
# shellcheck disable=SC2046
3563
npm run lint-changed

.github/workflows/postBuildStartedComment.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)