Remove dist changes

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Parker Brown
2026-03-13 16:03:39 -07:00
co-authored by Copilot
parent b24274086f
commit 2156e19368
2 changed files with 36 additions and 81 deletions
+2 -47
View File
@@ -47919,13 +47919,9 @@ async function pRetry(input, options = {}) {
} }
// lib/main.js // lib/main.js
async function main(appId2, privateKey2, enterpriseSlug2, owner2, repositories2, permissions2, core, createAppAuth2, request2, skipTokenRevoke2) { async function main(appId2, privateKey2, owner2, repositories2, permissions2, core, createAppAuth2, request2, skipTokenRevoke2) {
if (enterpriseSlug2 && (owner2 || repositories2.length > 0)) {
throw new Error("Cannot use 'enterprise-slug' input with 'owner' or 'repositories' inputs");
}
let parsedOwner = ""; let parsedOwner = "";
let parsedRepositoryNames = []; let parsedRepositoryNames = [];
if (!enterpriseSlug2) {
if (!owner2 && repositories2.length === 0) { if (!owner2 && repositories2.length === 0) {
const [owner3, repo] = String(process.env.GITHUB_REPOSITORY).split("/"); const [owner3, repo] = String(process.env.GITHUB_REPOSITORY).split("/");
parsedOwner = owner3; parsedOwner = owner3;
@@ -47957,29 +47953,13 @@ async function main(appId2, privateKey2, enterpriseSlug2, owner2, repositories2,
- ${parsedOwner}/${repo}`).join("")}` - ${parsedOwner}/${repo}`).join("")}`
); );
} }
} else {
core.info(`Creating enterprise installation token for enterprise "${enterpriseSlug2}".`);
}
const auth5 = createAppAuth2({ const auth5 = createAppAuth2({
appId: appId2, appId: appId2,
privateKey: privateKey2, privateKey: privateKey2,
request: request2 request: request2
}); });
let authentication, installationId, appSlug; let authentication, installationId, appSlug;
if (enterpriseSlug2) { if (parsedRepositoryNames.length > 0) {
({ authentication, installationId, appSlug } = await pRetry(
() => getTokenFromEnterprise(request2, auth5, enterpriseSlug2, permissions2),
{
shouldRetry: (error2) => error2.status >= 500,
onFailedAttempt: (error2) => {
core.info(
`Failed to create token for enterprise "${enterpriseSlug2}" (attempt ${error2.attemptNumber}): ${error2.message}`
);
},
retries: 3
}
));
} else if (parsedRepositoryNames.length > 0) {
({ authentication, installationId, appSlug } = await pRetry( ({ authentication, installationId, appSlug } = await pRetry(
() => getTokenFromRepository( () => getTokenFromRepository(
request2, request2,
@@ -48056,27 +48036,6 @@ async function getTokenFromRepository(request2, auth5, parsedOwner, parsedReposi
const appSlug = response.data["app_slug"]; const appSlug = response.data["app_slug"];
return { authentication, installationId, appSlug }; return { authentication, installationId, appSlug };
} }
async function getTokenFromEnterprise(request2, auth5, enterpriseSlug2, permissions2) {
const response = await request2("GET /app/installations", {
request: {
hook: auth5.hook
}
});
const enterpriseInstallation = response.data.find(
(installation) => installation.target_type === "Enterprise" && installation.account?.slug === enterpriseSlug2
);
if (!enterpriseInstallation) {
throw new Error(`No enterprise installation found matching the name ${enterpriseSlug2}. Available installations: ${response.data.map((i) => `${i.target_type}:${i.account?.login || "N/A"}`).join(", ")}`);
}
const authentication = await auth5({
type: "installation",
installationId: enterpriseInstallation.id,
permissions: permissions2
});
const installationId = enterpriseInstallation.id;
const appSlug = enterpriseInstallation["app_slug"];
return { authentication, installationId, appSlug };
}
// lib/request.js // lib/request.js
var import_undici2 = __toESM(require_undici2(), 1); var import_undici2 = __toESM(require_undici2(), 1);
@@ -48113,7 +48072,6 @@ if (!process.env.GITHUB_REPOSITORY_OWNER) {
} }
var appId = getInput("app-id"); var appId = getInput("app-id");
var privateKey = getInput("private-key"); var privateKey = getInput("private-key");
var enterpriseSlug = getInput("enterprise-slug");
var owner = getInput("owner"); var owner = getInput("owner");
var repositories = getInput("repositories").split(/[\n,]+/).map((s) => s.trim()).filter((x) => x !== ""); var repositories = getInput("repositories").split(/[\n,]+/).map((s) => s.trim()).filter((x) => x !== "");
var skipTokenRevoke = getBooleanInput("skip-token-revoke"); var skipTokenRevoke = getBooleanInput("skip-token-revoke");
@@ -48121,7 +48079,6 @@ var permissions = getPermissionsFromInputs(process.env);
var main_default = main( var main_default = main(
appId, appId,
privateKey, privateKey,
enterpriseSlug,
owner, owner,
repositories, repositories,
permissions, permissions,
@@ -48131,9 +48088,7 @@ var main_default = main(
skipTokenRevoke skipTokenRevoke
).catch((error2) => { ).catch((error2) => {
console.error(error2); console.error(error2);
if (process.env.GITHUB_OUTPUT !== void 0) {
setFailed(error2.message); setFailed(error2.message);
}
}); });
/*! Bundled license information: /*! Bundled license information: