Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
Browse files Browse the repository at this point in the history
…x/44480-fix-undesired-unavailable-workspace
  • Loading branch information
wildan-m committed Sep 9, 2024
2 parents d0a5e8b + aaa60b9 commit 73c2b03
Show file tree
Hide file tree
Showing 216 changed files with 6,714 additions and 3,103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function run() {
GitHubUtils.octokit.actions.listWorkflowRuns({
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
workflow_id: 'platformDeploy.yml',
workflow_id: 'deploy.yml',
event: 'push',
branch: tag,
}),
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12138,7 +12138,7 @@ function run() {
GithubUtils_1.default.octokit.actions.listWorkflowRuns({
owner: CONST_1.default.GITHUB_OWNER,
repo: CONST_1.default.APP_REPO,
workflow_id: 'platformDeploy.yml',
workflow_id: 'deploy.yml',
event: 'push',
branch: tag,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async function isReleaseValidBaseForEnvironment(releaseTag: string, isProduction
}

/**
* Was a given platformDeploy workflow run successful on at least one platform?
* Was a given deploy workflow run successful on at least one platform?
*/
async function wasDeploySuccessful(runID: number) {
const jobsForWorkflowRun = (
Expand Down Expand Up @@ -82,7 +82,7 @@ async function run() {

console.log(`Looking for PRs deployed to ${deployEnv} in ${inputTag}...`);

const completedDeploys = (
const platformDeploys = (
await GithubUtils.octokit.actions.listWorkflowRuns({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
Expand All @@ -95,6 +95,24 @@ async function run() {
// because if a build fails on even one platform, then it will have the status 'failure'
.filter((workflowRun) => workflowRun.conclusion !== 'cancelled');

const deploys = (
await GithubUtils.octokit.actions.listWorkflowRuns({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
// eslint-disable-next-line @typescript-eslint/naming-convention
workflow_id: 'deploy.yml',
status: 'completed',
})
).data.workflow_runs
// Note: we filter out cancelled runs instead of looking only for success runs
// because if a build fails on even one platform, then it will have the status 'failure'
.filter((workflowRun) => workflowRun.conclusion !== 'cancelled');

// W've combined platformDeploy.yml and deploy.yml
// TODO: Remove this once there are successful staging and production deploys using the new deploy.yml workflow
const completedDeploys = [...deploys, ...platformDeploys];
completedDeploys.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());

// Find the most recent deploy workflow targeting the correct environment, for which at least one of the build jobs finished successfully
let lastSuccessfulDeploy = completedDeploys.shift();

Expand Down
18 changes: 16 additions & 2 deletions .github/actions/javascript/getDeployPullRequestList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11526,7 +11526,7 @@ async function isReleaseValidBaseForEnvironment(releaseTag, isProductionDeploy)
return !isPrerelease;
}
/**
* Was a given platformDeploy workflow run successful on at least one platform?
* Was a given deploy workflow run successful on at least one platform?
*/
async function wasDeploySuccessful(runID) {
const jobsForWorkflowRun = (await GithubUtils_1.default.octokit.actions.listJobsForWorkflowRun({
Expand Down Expand Up @@ -11566,7 +11566,7 @@ async function run() {
const isProductionDeploy = !!(0, ActionUtils_1.getJSONInput)('IS_PRODUCTION_DEPLOY', { required: false }, false);
const deployEnv = isProductionDeploy ? 'production' : 'staging';
console.log(`Looking for PRs deployed to ${deployEnv} in ${inputTag}...`);
const completedDeploys = (await GithubUtils_1.default.octokit.actions.listWorkflowRuns({
const platformDeploys = (await GithubUtils_1.default.octokit.actions.listWorkflowRuns({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand All @@ -11576,6 +11576,20 @@ async function run() {
// Note: we filter out cancelled runs instead of looking only for success runs
// because if a build fails on even one platform, then it will have the status 'failure'
.filter((workflowRun) => workflowRun.conclusion !== 'cancelled');
const deploys = (await GithubUtils_1.default.octokit.actions.listWorkflowRuns({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
// eslint-disable-next-line @typescript-eslint/naming-convention
workflow_id: 'deploy.yml',
status: 'completed',
})).data.workflow_runs
// Note: we filter out cancelled runs instead of looking only for success runs
// because if a build fails on even one platform, then it will have the status 'failure'
.filter((workflowRun) => workflowRun.conclusion !== 'cancelled');
// W've combined platformDeploy.yml and deploy.yml
// TODO: Remove this once there are successful staging and production deploys using the new deploy.yml workflow
const completedDeploys = [...deploys, ...platformDeploys];
completedDeploys.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
// Find the most recent deploy workflow targeting the correct environment, for which at least one of the build jobs finished successfully
let lastSuccessfulDeploy = completedDeploys.shift();
if (!lastSuccessfulDeploy) {
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/validateActionsAndWorkflows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ for ((i=0; i < ${#WORKFLOWS[@]}; i++)); do
# Skip linting e2e workflow due to bug here: https://github.com/SchemaStore/schemastore/issues/2579
if [[ "$WORKFLOW" == './workflows/e2ePerformanceTests.yml'
|| "$WORKFLOW" == './workflows/testBuild.yml'
|| "$WORKFLOW" == './workflows/platformDeploy.yml' ]]; then
|| "$WORKFLOW" == './workflows/deploy.yml' ]]; then
continue
fi

Expand Down
Loading

0 comments on commit 73c2b03

Please sign in to comment.