Home / Function/ checkForImmutableCommit() — supabase Function Reference

checkForImmutableCommit() — supabase Function Reference

Architecture documentation for the checkForImmutableCommit() function in octokit.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  65d39265_59d2_2308_2c7d_2d59c9134267["checkForImmutableCommit()"]
  ee8de8b7_e8af_56c2_fb6b_f0ff1d2a3bdd["getGitHubFileContentsImmutableOnly()"]
  ee8de8b7_e8af_56c2_fb6b_f0ff1d2a3bdd -->|calls| 65d39265_59d2_2308_2c7d_2d59c9134267
  849f251d_84e6_f75c_65e8_837d964c4544["octokit()"]
  65d39265_59d2_2308_2c7d_2d59c9134267 -->|calls| 849f251d_84e6_f75c_65e8_837d964c4544
  style 65d39265_59d2_2308_2c7d_2d59c9134267 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/lib/octokit.ts lines 123–164

async function checkForImmutableCommit({
  org,
  repo,
  branch,
  options: { fetch: _fetch = fetch } = {},
}: {
  org: string
  repo: string
  branch: string
  options?: {
    /**
     *
     * A custom fetch implementation to control Next.js caching.
     */
    fetch?: (info: RequestInfo, init?: RequestInit) => Promise<Response>
  }
}) {
  try {
    const response = await octokit().request('GET /repos/{owner}/{repo}/git/commits/{commit_sha}', {
      owner: org,
      repo: repo,
      commit_sha: branch,
      headers: {
        'X-GitHub-Api-Version': '2022-11-28',
      },
      options: {
        fetch: _fetch,
      },
    })
    if (response.status === 200) {
      return true
    } else {
      throw Error(
        "Checking for an immutable commit didn't throw an error, but it also didn't return a 200. Erring on the side of safety, assuming this is not an immutable commit.",
        { cause: response }
      )
    }
  } catch (err) {
    console.error('Not an immutable commit: %o', err)
    return false
  }
}

Subdomains

Calls

Frequently Asked Questions

What does checkForImmutableCommit() do?
checkForImmutableCommit() is a function in the supabase codebase.
What does checkForImmutableCommit() call?
checkForImmutableCommit() calls 1 function(s): octokit.
What calls checkForImmutableCommit()?
checkForImmutableCommit() is called by 1 function(s): getGitHubFileContentsImmutableOnly.

Analyze Your Own Codebase

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

Try Supermodel Free