[No QA] Improve workflow failure notifier#41124
Conversation
…revious workflow run and jobs
| if (previousRun.actor.login === 'OSBotify') { | ||
| return allRuns.data.workflow_runs.find(run => run.run_number === run_number - 2); | ||
| } |
There was a problem hiding this comment.
I don't think this will work if multiple runs are from OSBotify. Can we just filter out any runs with actor.login === 'OSBotify' first before getting the last one? Do we also need to filter out cancelled runs?
| const existingIssue = issues.data.find(issue => issue.title.includes(jobName)); | ||
| if (!existingIssue) { | ||
| const previousJob = previousRunJobs.jobs.find(job => job.name === jobName); | ||
| previousJobSucceeded = previousJob.conclusion === 'success'; |
There was a problem hiding this comment.
| previousJobSucceeded = previousJob.conclusion === 'success'; | |
| previousJobSucceeded = previousJob?.conclusion === 'success'; |
I guess it's possible that previousJob could return false for some reason.
| if (!existingIssue) { | ||
| const previousJob = previousRunJobs.jobs.find(job => job.name === jobName); | ||
| previousJobSucceeded = previousJob.conclusion === 'success'; | ||
| if (previousJobSucceeded) { |
There was a problem hiding this comment.
| if (previousJobSucceeded) { | |
| if (previousJob?.conclusion === 'success') { |
I don't think there's much benefit to having previousJobSucceeded since we don't use it anywhere else.
| }); | ||
| const run = allRuns.data.workflow_runs.find(run => run.id === runId); | ||
| const run_number = run.run_number; | ||
| const previousRun = allRuns.data.workflow_runs.find(run => run.run_number === run_number - 1); |
There was a problem hiding this comment.
I guess run_number is always consecutive? I wonder if it's safer to use findIndex to get the current run and then select the previous run using the index?
jjcoffee
left a comment
There was a problem hiding this comment.
Looking good! Just a few comments to address.
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
|
Comments addressed in aa13921 |
| }); | ||
| const filteredRuns = allRuns.data.workflow_runs.filter(run => run.actor.login !== 'OSBotify' && run.status !== 'cancelled'); | ||
| const currentIndex = filteredRuns.findIndex(run => run.id === runId); | ||
| const previousRun = filteredRuns[currentIndex + 1]; |
There was a problem hiding this comment.
The array is sorted by most recent first:
https://api.github.com/repos/Expensify/App/actions/workflows/preDeploy.yml/runs
jjcoffee
left a comment
There was a problem hiding this comment.
Code LGTM and tests well!
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/blimpich in version: 1.4.69-0 🚀
|
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.4.69-2 🚀
|
Details
Fixed Issues
$ #40612
PROPOSAL: N/A
https://expensify.slack.com/archives/C01GTK53T8Q/p1713557143833969?thread_ts=1713554811.796439&cid=C01GTK53T8Q
Tests
Test on a sample repo: https://github.com/rayane-djouah/testworkflow
Offline tests
N/A
QA Steps
N/A
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Screen.Recording.2024-04-28.at.4.22.10.PM.mov
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop