forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Expensify:main' into fix/33797
- Loading branch information
Showing
687 changed files
with
16,917 additions
and
10,459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
name: Notify on Workflow Failure | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Process new code merged to main"] | ||
types: | ||
- completed | ||
|
||
permissions: | ||
issues: write | ||
|
||
jobs: | ||
notifyFailure: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'failure' }} | ||
steps: | ||
- name: Fetch Workflow Run Jobs | ||
id: fetch-workflow-jobs | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const runId = "${{ github.event.workflow_run.id }}"; | ||
const jobsData = await github.rest.actions.listJobsForWorkflowRun({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: runId, | ||
}); | ||
return jobsData.data; | ||
- name: Process Each Failed Job | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const jobs = ${{ steps.fetch-workflow-jobs.outputs.result }}; | ||
const headCommit = "${{ github.event.workflow_run.head_commit.id }}"; | ||
const prData = await github.rest.repos.listPullRequestsAssociatedWithCommit({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
commit_sha: headCommit, | ||
}); | ||
const pr = prData.data[0]; | ||
const prLink = pr.html_url; | ||
const prAuthor = pr.user.login; | ||
const prMerger = "${{ github.event.workflow_run.actor.login }}"; | ||
const failureLabel = 'Workflow Failure'; | ||
for (let i = 0; i < jobs.total_count; i++) { | ||
if (jobs.jobs[i].conclusion == 'failure') { | ||
const jobName = jobs.jobs[i].name; | ||
const jobLink = jobs.jobs[i].html_url; | ||
const issues = await github.rest.issues.listForRepo({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: failureLabel, | ||
state: 'open' | ||
}); | ||
const existingIssue = issues.data.find(issue => issue.title.includes(jobName)); | ||
if (!existingIssue) { | ||
const annotations = await github.rest.checks.listAnnotations({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
check_run_id: jobs.jobs[i].id, | ||
}); | ||
let errorMessage = ""; | ||
for(let j = 0; j < annotations.data.length; j++) { | ||
errorMessage += annotations.data[j].annotation_level + ": "; | ||
errorMessage += annotations.data[j].message + "\n"; | ||
} | ||
const issueTitle = `Investigate workflow job failing on main: ${ jobName }`; | ||
const issueBody = `🚨 **Failure Summary** 🚨:\n\n` + | ||
`- **📋 Job Name**: [${ jobName }](${ jobLink })\n` + | ||
`- **🔧 Failure in Workflow**: Process new code merged to main\n` + | ||
`- **🔗 Triggered by PR**: [PR Link](${ prLink })\n` + | ||
`- **👤 PR Author**: @${ prAuthor }\n` + | ||
`- **🤝 Merged by**: @${ prMerger }\n` + | ||
`- **🐛 Error Message**: \n ${errorMessage}\n\n` + | ||
`⚠️ **Action Required** ⚠️:\n\n` + | ||
`🛠️ A recent merge appears to have caused a failure in the job named [${ jobName }](${ jobLink }).\n` + | ||
`This issue has been automatically created and labeled with \`${ failureLabel }\` for investigation. \n\n` + | ||
`👀 **Please look into the following**:\n` + | ||
`1. **Why the PR caused the job to fail?**\n` + | ||
`2. **Address any underlying issues.**\n\n` + | ||
`🐛 We appreciate your help in squashing this bug!`; | ||
await github.rest.issues.create({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
title: issueTitle, | ||
body: issueBody, | ||
labels: [failureLabel, 'Daily'], | ||
assignees: [prMerger] | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import {NetInfoCellularGeneration, NetInfoStateType} from '@react-native-community/netinfo'; | ||
import type {addEventListener, configure, fetch, NetInfoState, refresh, useNetInfo} from '@react-native-community/netinfo'; | ||
|
||
const defaultState: NetInfoState = { | ||
type: NetInfoStateType.cellular, | ||
isConnected: true, | ||
isInternetReachable: true, | ||
details: { | ||
isConnectionExpensive: true, | ||
cellularGeneration: NetInfoCellularGeneration['3g'], | ||
carrier: 'T-Mobile', | ||
}, | ||
}; | ||
|
||
type NetInfoMock = { | ||
configure: typeof configure; | ||
fetch: typeof fetch; | ||
refresh: typeof refresh; | ||
addEventListener: typeof addEventListener; | ||
useNetInfo: typeof useNetInfo; | ||
}; | ||
|
||
const netInfoMock: NetInfoMock = { | ||
configure: () => {}, | ||
fetch: () => Promise.resolve(defaultState), | ||
refresh: () => Promise.resolve(defaultState), | ||
addEventListener: () => () => {}, | ||
useNetInfo: () => defaultState, | ||
}; | ||
|
||
export default netInfoMock; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type {FirebaseCrashlyticsTypes} from '@react-native-firebase/crashlytics'; | ||
|
||
type CrashlyticsModule = Pick<FirebaseCrashlyticsTypes.Module, 'log' | 'recordError' | 'setCrashlyticsCollectionEnabled'>; | ||
|
||
type CrashlyticsMock = () => CrashlyticsModule; | ||
|
||
// <App> uses <ErrorBoundary> and we need to mock the imported crashlytics module | ||
// due to an error that happens otherwise https://github.com/invertase/react-native-firebase/issues/2475 | ||
const crashlyticsMock: CrashlyticsMock = () => ({ | ||
log: jest.fn(), | ||
recordError: jest.fn(), | ||
setCrashlyticsCollectionEnabled: jest.fn(), | ||
}); | ||
|
||
export default crashlyticsMock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type PerfMock = () => void; | ||
|
||
const perfMock: PerfMock = () => {}; | ||
|
||
export default perfMock; |
2 changes: 1 addition & 1 deletion
2
__mocks__/@react-navigation/native/index.js → __mocks__/@react-navigation/native/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type {Freeze as FreezeComponent} from 'react-freeze'; | ||
|
||
const Freeze: typeof FreezeComponent = (props) => props.children as JSX.Element; | ||
|
||
export { | ||
// eslint-disable-next-line import/prefer-default-export | ||
Freeze, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type RNFetchBlob from 'react-native-blob-util'; | ||
|
||
const ReactNativeBlobUtilMock: Partial<typeof RNFetchBlob> = {}; | ||
|
||
export default ReactNativeBlobUtilMock; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type {addItem} from 'react-native-dev-menu'; | ||
|
||
type ReactNativeDevMenuMock = { | ||
addItem: typeof addItem; | ||
}; | ||
|
||
const reactNativeDevMenuMock: ReactNativeDevMenuMock = { | ||
addItem: jest.fn(), | ||
}; | ||
|
||
export default reactNativeDevMenuMock; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type DeviceInfoModule from 'react-native-device-info'; | ||
import MockDeviceInfo from 'react-native-device-info/jest/react-native-device-info-mock'; | ||
|
||
const DeviceInfo: typeof DeviceInfoModule = MockDeviceInfo; | ||
|
||
export default DeviceInfo; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import mockRNLocalize from 'react-native-localize/mock'; | ||
|
||
module.exports = mockRNLocalize; |
Oops, something went wrong.