Skip to content

Commit

Permalink
ci: logging informations
Browse files Browse the repository at this point in the history
  • Loading branch information
levisingularity committed Jul 19, 2024
1 parent bc79b12 commit 0bf2ca8
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/invoke-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit 0bf2ca8

Please sign in to comment.