Home / Function/ pollUntilWorkflowFinishes() — react Function Reference

pollUntilWorkflowFinishes() — react Function Reference

Architecture documentation for the pollUntilWorkflowFinishes() function in publish-using-ci-workflow.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  8882da9a_b55e_e92b_03a4_ab9b56e99e14["pollUntilWorkflowFinishes()"]
  37d61257_7834_7ff9_7756_2c4472479997["publish-using-ci-workflow.js"]
  8882da9a_b55e_e92b_03a4_ab9b56e99e14 -->|defined in| 37d61257_7834_7ff9_7756_2c4472479997
  7f9da990_f5b0_b840_dce2_63cf0c639a81["main()"]
  7f9da990_f5b0_b840_dce2_63cf0c639a81 -->|calls| 8882da9a_b55e_e92b_03a4_ab9b56e99e14
  4ed76040_992b_9e9e_bb8b_ff567ba35102["sleep()"]
  8882da9a_b55e_e92b_03a4_ab9b56e99e14 -->|calls| 4ed76040_992b_9e9e_bb8b_ff567ba35102
  style 8882da9a_b55e_e92b_03a4_ab9b56e99e14 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/release/publish-using-ci-workflow.js lines 46–80

async function pollUntilWorkflowFinishes(workflowID) {
  while (true) {
    const workflowResponse = await fetch(
      `https://circleci.com/api/v2/workflow/${workflowID}`
    );
    const workflow = await workflowResponse.json();
    switch (workflow.status) {
      case 'running':
        // Workflow still running. Wait a bit then check again.
        await sleep(2000);
        continue;
      case 'success':
        // Publish succeeded! Continue.
        return;
      case 'not_run':
      case 'failed':
      case 'error':
      case 'failing':
      case 'on_hold':
      case 'canceled':
      case 'unauthorized':
      default:
        console.error(
          theme.error(
            `Failed to publish. Workflow exited with status: ${workflow.status}`
          )
        );
        console.error(
          `Visit https://app.circleci.com/pipelines/workflows/${workflowID} for details.`
        );
        process.exit(1);
        break;
    }
  }
}

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does pollUntilWorkflowFinishes() do?
pollUntilWorkflowFinishes() is a function in the react codebase, defined in scripts/release/publish-using-ci-workflow.js.
Where is pollUntilWorkflowFinishes() defined?
pollUntilWorkflowFinishes() is defined in scripts/release/publish-using-ci-workflow.js at line 46.
What does pollUntilWorkflowFinishes() call?
pollUntilWorkflowFinishes() calls 1 function(s): sleep.
What calls pollUntilWorkflowFinishes()?
pollUntilWorkflowFinishes() is called by 1 function(s): main.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free