Skip to content

Commit

Permalink
Merge branch 'main' into fix/34120
Browse files Browse the repository at this point in the history
  • Loading branch information
dukenv0307 committed Apr 17, 2024
2 parents 2ab8b38 + 314f2d3 commit 67a43d7
Show file tree
Hide file tree
Showing 889 changed files with 47,188 additions and 56,794 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# Every PR gets a review from an internal Expensify engineer
* @Expensify/pullerbear

# Assign the Design team to review changes to our styles & assets
src/styles/ @Expensify/design @Expensify/pullerbear
assets/ @Expensify/design @Expensify/pullerbear
2 changes: 1 addition & 1 deletion .github/actionlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
self-hosted-runner:
labels:
- ubuntu-latest-xl
- macos-12-xl
- macos-13-large
- macos-13-xlarge
- ubuntu-latest-reassure-tests
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import github from '@actions/github';
import * as github from '@actions/github';
import {parse} from '@babel/parser';
import traverse from '@babel/traverse';
import CONST from '@github/libs/CONST';
Expand Down
3,145 changes: 1,389 additions & 1,756 deletions .github/actions/javascript/authorChecklist/index.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
const _ = require('underscore');
const lodashThrottle = require('lodash/throttle');
const CONST = require('../../../libs/CONST');
const ActionUtils = require('../../../libs/ActionUtils');
const GitHubUtils = require('../../../libs/GithubUtils');
const {promiseDoWhile} = require('../../../libs/promiseWhile');
/* eslint-disable @typescript-eslint/naming-convention */
import lodashThrottle from 'lodash/throttle';
import {getStringInput} from '@github/libs/ActionUtils';
import CONST from '@github/libs/CONST';
import GitHubUtils from '@github/libs/GithubUtils';
import {promiseDoWhile} from '@github/libs/promiseWhile';

type CurrentStagingDeploys = Awaited<ReturnType<typeof GitHubUtils.octokit.actions.listWorkflowRuns>>['data']['workflow_runs'];

function run() {
console.info('[awaitStagingDeploys] run()');
console.info('[awaitStagingDeploys] ActionUtils', ActionUtils);
console.info('[awaitStagingDeploys] getStringInput', getStringInput);
console.info('[awaitStagingDeploys] GitHubUtils', GitHubUtils);
console.info('[awaitStagingDeploys] promiseDoWhile', promiseDoWhile);

const tag = ActionUtils.getStringInput('TAG', {required: false});
const tag = getStringInput('TAG', {required: false});
console.info('[awaitStagingDeploys] run() tag', tag);

let currentStagingDeploys = [];
let currentStagingDeploys: CurrentStagingDeploys = [];

console.info('[awaitStagingDeploys] run() _.throttle', _.throttle);
console.info('[awaitStagingDeploys] run() _.throttle', lodashThrottle);

const throttleFunc = () =>
Promise.all([
Expand All @@ -39,29 +41,32 @@ function run() {
}),
])
.then((responses) => {
console.info('[awaitStagingDeploys] listWorkflowRuns responses', responses);
const workflowRuns = responses[0].data.workflow_runs;
if (!tag) {
if (!tag && typeof responses[1] === 'object') {
workflowRuns.push(...responses[1].data.workflow_runs);
}
console.info('[awaitStagingDeploys] workflowRuns', workflowRuns);
return workflowRuns;
})
.then((workflowRuns) => (currentStagingDeploys = _.filter(workflowRuns, (workflowRun) => workflowRun.status !== 'completed')))
.then(() =>
.then((workflowRuns) => (currentStagingDeploys = workflowRuns.filter((workflowRun) => workflowRun.status !== 'completed')))
.then(() => {
console.info('[awaitStagingDeploys] currentStagingDeploys', currentStagingDeploys);
console.log(
_.isEmpty(currentStagingDeploys)
!currentStagingDeploys.length
? 'No current staging deploys found'
: `Found ${currentStagingDeploys.length} staging deploy${currentStagingDeploys.length > 1 ? 's' : ''} still running...`,
),
);
);
});
console.info('[awaitStagingDeploys] run() throttleFunc', throttleFunc);

return promiseDoWhile(
() => !_.isEmpty(currentStagingDeploys),
() => !!currentStagingDeploys.length,
lodashThrottle(
throttleFunc,

// Poll every 60 seconds instead of every 10 seconds
GitHubUtils.POLL_RATE * 6,
CONST.POLL_RATE * 6,
),
);
}
Expand All @@ -70,4 +75,4 @@ if (require.main === module) {
run();
}

module.exports = run;
export default run;
Loading

0 comments on commit 67a43d7

Please sign in to comment.