From b5050191a49cccfd4ebd2c613236accdf49ff147 Mon Sep 17 00:00:00 2001 From: Mrugesh Mohapatra Date: Mon, 24 Mar 2025 12:36:35 +0530 Subject: [PATCH] fix(GHA): remove validations --- .github/workflows/deploy-legacy.yml | 83 ----------------------------- 1 file changed, 83 deletions(-) diff --git a/.github/workflows/deploy-legacy.yml b/.github/workflows/deploy-legacy.yml index 77de15721c1..19971673fe5 100644 --- a/.github/workflows/deploy-legacy.yml +++ b/.github/workflows/deploy-legacy.yml @@ -29,89 +29,6 @@ jobs: ;; esac - - name: Validate - id: check - uses: actions/github-script@v7 - with: - script: | - const workflows = ['node.js-tests.yml']; - const owner = context.repo.owner; - const repo = context.repo.repo; - const branch = context.ref.replace('refs/heads/', ''); - const sha = context.sha; - const MAX_RETRIES = 5; - const WAIT_TIME = 5 * 60 * 1000; // 5 minutes in milliseconds - - async function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function checkWorkflow(workflow_id, retryCount = 0) { - console.log(`\nChecking workflow ${workflow_id} for branch ${branch} at commit ${sha} (attempt ${retryCount + 1}/${MAX_RETRIES})`); - - const response = await github.rest.actions.listWorkflowRuns({ - owner, - repo, - workflow_id, - branch, - head_sha: sha, - status: 'completed', - per_page: 1 - }); - - if (response.data.workflow_runs.length === 0) { - if (retryCount < MAX_RETRIES) { - console.log(`No completed workflow runs found. Waiting ${WAIT_TIME/1000} seconds before retry...`); - await sleep(WAIT_TIME); - return checkWorkflow(workflow_id, retryCount + 1); - } - core.setFailed(`No completed workflow runs found for ${workflow_id} on branch ${branch} after ${MAX_RETRIES} attempts`); - return false; - } - - const latestRun = response.data.workflow_runs[0]; - console.log(`Latest run: ${latestRun.html_url}`); - console.log(`Status: ${latestRun.status}`); - console.log(`Conclusion: ${latestRun.conclusion}`); - - if (latestRun.status !== 'completed') { - if (retryCount < MAX_RETRIES) { - console.log(`Workflow not completed. Waiting ${WAIT_TIME/1000} seconds before retry...`); - await sleep(WAIT_TIME); - return checkWorkflow(workflow_id, retryCount + 1); - } - core.setFailed(`Latest workflow run is not completed after ${MAX_RETRIES} attempts. Current status: ${latestRun.status}`); - return false; - } - - if (latestRun.conclusion === 'cancelled') { - core.setFailed(`Workflow ${workflow_id} was cancelled on branch ${branch} at commit ${sha}`); - return false; - } - - if (latestRun.conclusion === 'failure') { - const failureMessage = `Workflow ${workflow_id} failed on branch ${branch} at commit ${sha}. ` + - `Latest run: ${latestRun.html_url}. Conclusion: ${latestRun.conclusion}`; - core.setFailed(failureMessage); - return false; - } - - if (latestRun.conclusion !== 'success') { - core.setFailed(`Unexpected workflow conclusion: ${latestRun.conclusion}`); - return false; - } - - return true; - } - - for (const workflow_id of workflows) { - const result = await checkWorkflow(workflow_id); - if (!result) return false; - } - - console.log('\nAll workflow checks passed!'); - return true; - api: name: API (Legacy) - [${{ needs.setup-jobs.outputs.tgt_env_short }}] needs: [setup-jobs]