diff --git a/.github/workflows/invoke-workflow.yml b/.github/workflows/invoke-workflow.yml index 9c660ed..861181b 100644 --- a/.github/workflows/invoke-workflow.yml +++ b/.github/workflows/invoke-workflow.yml @@ -31,6 +31,9 @@ jobs: const repo = '${{ inputs.repo }}'; const ref = '${{ inputs.ref }}'; const owner = context.repo.owner; + const timestamp = new Date().toISOString(); + + console.log(`[${timestamp}] Starting workflow with ID: ${workflow_id} on the repository: ${repo}.`); await github.rest.actions.createWorkflowDispatch({ owner, @@ -57,7 +60,12 @@ jobs: const run_id = runs.data.workflow_runs[0].id; - console.log(run_id) + console.log(`Workflow run retrieved. Details: + - Owner: ${owner} + - Repository: ${repo} + - Workflow ID: ${workflow_id} + - Run ID: ${run_id}`); + core.setOutput('run-id', run_id); - name: Wait for workflow to complete @@ -71,23 +79,27 @@ jobs: const repo = '${{ inputs.repo }}'; let conclusion = null; - console.log("run_id", run_id) + console.log(`Starting to monitor workflow run with ID: ${run_id} for completion in repository: ${repo}.`); while (!conclusion) { + console.log(`Checking status of workflow run with ID: ${run_id}...`); + + console.log(run); + await new Promise(resolve => setTimeout(resolve, 30000)); + const run = await github.rest.actions.getWorkflowRun({ owner, repo, run_id, }); + console.log(`Current status of workflow run ID ${run_id}: ${run.data.status}`); + if (run.data.status === 'completed') { conclusion = run.data.conclusion; + console.log(`Workflow run with ID ${run_id} has completed with conclusion: ${conclusion}`); } - - console.log("status", run.data.status) - console.log("conclusion", conclusion) - } core.setOutput('conclusion', conclusion);