MCPcopy Create free account
hub / github.com/github/gh-aw / normalizeRepo

Function normalizeRepo

actions/setup/js/invocation_context_helpers.cjs:34–49  ·  view source on GitHub ↗

* Normalize a repo object into { owner, repo } shape. * @param {unknown} repoValue * @returns {RepoRef|null}

(repoValue)

Source from the content-addressed store, hash-verified

32 * @returns {RepoRef|null}
33 */
34function normalizeRepo(repoValue) {
35 if (!repoValue || typeof repoValue !== "object") {
36 return null;
37 }
38
39 /** @type {{ owner?: unknown, repo?: unknown }} */
40 const maybeRepo = repoValue;
41 if (typeof maybeRepo.owner === "string" && typeof maybeRepo.repo === "string" && maybeRepo.owner && maybeRepo.repo) {
42 return {
43 owner: maybeRepo.owner,
44 repo: maybeRepo.repo,
45 };
46 }
47
48 return null;
49}
50
51/**
52 * Extract a repository from event payload.repository.

Callers 1

resolveInvocationContextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected