Home / Function/ downloadArtifactsFromGitHub() — react Function Reference

downloadArtifactsFromGitHub() — react Function Reference

Architecture documentation for the downloadArtifactsFromGitHub() function in download-build-artifacts.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  a9106a40_7dcd_d923_0663_c543c16b405d["downloadArtifactsFromGitHub()"]
  b7e2774f_9b65_2f26_1d36_abceee1db3ae["download-build-artifacts.js"]
  a9106a40_7dcd_d923_0663_c543c16b405d -->|defined in| b7e2774f_9b65_2f26_1d36_abceee1db3ae
  077396f7_c5d7_c509_1aa8_86e4785411ba["downloadBuildArtifacts()"]
  077396f7_c5d7_c509_1aa8_86e4785411ba -->|calls| a9106a40_7dcd_d923_0663_c543c16b405d
  49e297f4_16bd_0ef1_1200_9acfefde5146["getWorkflowRun()"]
  a9106a40_7dcd_d923_0663_c543c16b405d -->|calls| 49e297f4_16bd_0ef1_1200_9acfefde5146
  f4f47709_6954_8754_c565_8afc1733bf1d["sleep()"]
  a9106a40_7dcd_d923_0663_c543c16b405d -->|calls| f4f47709_6954_8754_c565_8afc1733bf1d
  24883978_a238_d729_1971_aa86ee53975b["getArtifact()"]
  a9106a40_7dcd_d923_0663_c543c16b405d -->|calls| 24883978_a238_d729_1971_aa86ee53975b
  4291e1a8_d44d_9d02_52de_aac73fe34e49["processArtifact()"]
  a9106a40_7dcd_d923_0663_c543c16b405d -->|calls| 4291e1a8_d44d_9d02_52de_aac73fe34e49
  style a9106a40_7dcd_d923_0663_c543c16b405d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/release/shared-commands/download-build-artifacts.js lines 161–214

async function downloadArtifactsFromGitHub(opts) {
  let workflowRun;
  let retries = 0;
  // wait up to 10 mins for build to finish: 10 * 60 * 1_000) / 30_000 = 20
  while (retries < 20) {
    workflowRun = await getWorkflowRun(opts.commit);
    if (typeof workflowRun.status === 'string') {
      switch (workflowRun.status) {
        case 'queued':
        case 'in_progress':
        case 'waiting': {
          retries++;
          console.log(theme`Build still in progress, waiting 30s...`);
          await sleep(30_000);
          break;
        }
        case 'completed': {
          if (workflowRun.conclusion === 'success') {
            const artifact = await getArtifact(
              workflowRun.id,
              'artifacts_combined'
            );
            await processArtifact(artifact, opts);
            return;
          } else {
            console.log(
              theme`{error Could not download build as its conclusion was: ${workflowRun.conclusion}}`
            );
            process.exit(1);
          }
          break;
        }
        default: {
          console.log(
            theme`{error Unhandled workflow run status: ${workflowRun.status}}`
          );
          process.exit(1);
        }
      }
    } else {
      retries++;
      console.log(
        theme`{error Expected workflow run status to be a string, got: ${workflowRun.status}. Retrying...}`
      );
    }
  }

  console.log(
    theme`{error Could not download build from GitHub. Last workflow run: }

${workflowRun != null ? JSON.stringify(workflowRun, null, '\t') : workflowRun}`
  );
  process.exit(1);
}

Domain

Subdomains

Frequently Asked Questions

What does downloadArtifactsFromGitHub() do?
downloadArtifactsFromGitHub() is a function in the react codebase, defined in scripts/release/shared-commands/download-build-artifacts.js.
Where is downloadArtifactsFromGitHub() defined?
downloadArtifactsFromGitHub() is defined in scripts/release/shared-commands/download-build-artifacts.js at line 161.
What does downloadArtifactsFromGitHub() call?
downloadArtifactsFromGitHub() calls 4 function(s): getArtifact, getWorkflowRun, processArtifact, sleep.
What calls downloadArtifactsFromGitHub()?
downloadArtifactsFromGitHub() is called by 1 function(s): downloadBuildArtifacts.

Analyze Your Own Codebase

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

Try Supermodel Free