Skip to content

Commit

Permalink
fix merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
tienifr committed Apr 2, 2024
2 parents a19beb1 + a4d01a8 commit 6367292
Show file tree
Hide file tree
Showing 352 changed files with 7,102 additions and 11,488 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,14 @@ module.exports = {
message: "Please don't declare enums, use union types instead.",
},
],
'no-restricted-properties': [
'error',
{
object: 'Image',
property: 'getSize',
message: 'Usage of Image.getImage is restricted. Please use the `react-native-image-size`.',
},
],
'no-restricted-imports': [
'error',
{
Expand Down
1 change: 1 addition & 0 deletions .github/actions/javascript/authorChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16918,6 +16918,7 @@ const POLL_RATE = 10000;
exports.POLL_RATE = POLL_RATE;
class GithubUtils {
static internalOctokit;
static POLL_RATE;
/**
* Initialize internal octokit
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,64 @@
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');

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

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

let currentStagingDeploys = [];

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

const throttleFunc = () =>
Promise.all([
// These are active deploys
GitHubUtils.octokit.actions.listWorkflowRuns({
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
workflow_id: 'platformDeploy.yml',
event: 'push',
branch: tag,
}),

// These have the potential to become active deploys, so we need to wait for them to finish as well (unless we're looking for a specific tag)
// In this context, we'll refer to unresolved preDeploy workflow runs as staging deploys as well
!tag &&
GitHubUtils.octokit.actions.listWorkflowRuns({
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
workflow_id: 'preDeploy.yml',
}),
])
.then((responses) => {
const workflowRuns = responses[0].data.workflow_runs;
if (!tag) {
workflowRuns.push(...responses[1].data.workflow_runs);
}
return workflowRuns;
})
.then((workflowRuns) => (currentStagingDeploys = _.filter(workflowRuns, (workflowRun) => workflowRun.status !== 'completed')))
.then(() =>
console.log(
_.isEmpty(currentStagingDeploys)
? '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),
_.throttle(
() =>
Promise.all([
// These are active deploys
GitHubUtils.octokit.actions.listWorkflowRuns({
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
workflow_id: 'platformDeploy.yml',
event: 'push',
branch: tag,
}),

// These have the potential to become active deploys, so we need to wait for them to finish as well (unless we're looking for a specific tag)
// In this context, we'll refer to unresolved preDeploy workflow runs as staging deploys as well
!tag &&
GitHubUtils.octokit.actions.listWorkflowRuns({
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
workflow_id: 'preDeploy.yml',
}),
])
.then((responses) => {
const workflowRuns = responses[0].data.workflow_runs;
if (!tag) {
workflowRuns.push(...responses[1].data.workflow_runs);
}
return workflowRuns;
})
.then((workflowRuns) => (currentStagingDeploys = _.filter(workflowRuns, (workflowRun) => workflowRun.status !== 'completed')))
.then(() =>
console.log(
_.isEmpty(currentStagingDeploys)
? 'No current staging deploys found'
: `Found ${currentStagingDeploys.length} staging deploy${currentStagingDeploys.length > 1 ? 's' : ''} still running...`,
),
),
lodashThrottle(
throttleFunc,

// Poll every 60 seconds instead of every 10 seconds
GitHubUtils.POLL_RATE * 6,
Expand Down
Loading

0 comments on commit 6367292

Please sign in to comment.