From a171f04890d8e3b8a42804df3d6751127e3a7e31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=99=E6=BC=A0=E4=B9=8B=E5=AD=90?= <7850715+maboloshi@users.noreply.github.com> Date: Sun, 18 Feb 2024 14:00:40 +0800 Subject: [PATCH 1/5] feat: add GitHub App's slug (`app-slug`) output --- README.md | 4 + action.yml | 2 + dist/main.cjs | 168 ++++++++++-------- dist/post.cjs | 151 ++++++++-------- lib/main.js | 23 ++- tests/main-repo-skew.js | 4 +- ...n-get-owner-set-repo-fail-response.test.js | 3 +- ...en-get-owner-set-to-org-repo-unset.test.js | 5 +- ...et-owner-set-to-user-fail-response.test.js | 5 +- ...n-get-owner-set-to-user-repo-unset.test.js | 5 +- ...n-token-get-owner-unset-repo-unset.test.js | 5 +- tests/main.js | 5 +- 12 files changed, 208 insertions(+), 172 deletions(-) diff --git a/README.md b/README.md index f7ec8d1..170b1c9 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,10 @@ on: [push] GitHub App installation access token. +### `app-slug` + +GitHub App's slug. + ## How it works The action creates an installation access token using [the `POST /app/installations/{installation_id}/access_tokens` endpoint](https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app). By default, diff --git a/action.yml b/action.yml index e150b71..5a6d85b 100644 --- a/action.yml +++ b/action.yml @@ -40,6 +40,8 @@ inputs: outputs: token: description: "GitHub installation access token" + app-slug: + description: "GitHub App's slug" runs: using: "node20" main: "dist/main.cjs" diff --git a/dist/main.cjs b/dist/main.cjs index 491bae2..ad1529e 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -13800,15 +13800,16 @@ var require_util2 = __commonJS({ return result; } var esIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())); - function makeIterator(iterator, name, kind) { + function makeIterator(iterator, name, kind, keyIndex = 0, valueIndex = 1) { const object = { index: 0, kind, target: iterator }; - const i = { - next() { - if (Object.getPrototypeOf(this) !== i) { + const iteratorObject = Object.create(esIteratorPrototype); + Object.defineProperty(iteratorObject, "next", { + value: function next() { + if (Object.getPrototypeOf(this) !== iteratorObject) { throw new TypeError( `'next' called on an object that does not implement interface ${name} Iterator.` ); @@ -13819,34 +13820,36 @@ var require_util2 = __commonJS({ if (index >= len) { return { value: void 0, done: true }; } - const pair = values[index]; + const { [keyIndex]: key, [valueIndex]: value } = values[index]; object.index = index + 1; - return iteratorResult(pair, kind2); + let result; + switch (kind2) { + case "key": + result = key; + break; + case "value": + result = value; + break; + case "key+value": + result = [key, value]; + break; + } + return { + value: result, + done: false + }; }, - // The class string of an iterator prototype object for a given interface is the - // result of concatenating the identifier of the interface and the string " Iterator". - [Symbol.toStringTag]: `${name} Iterator` - }; - Object.setPrototypeOf(i, esIteratorPrototype); - return Object.setPrototypeOf({}, i); - } - function iteratorResult(pair, kind) { - let result; - switch (kind) { - case "key": { - result = pair[0]; - break; - } - case "value": { - result = pair[1]; - break; - } - case "key+value": { - result = pair; - break; - } - } - return { value: result, done: false }; + writable: true, + enumerable: true, + configurable: true + }); + Object.defineProperty(iteratorObject, Symbol.toStringTag, { + value: `${name} Iterator`, + writable: false, + enumerable: false, + configurable: true + }); + return Object.create(iteratorObject); } async function fullyReadBody(body, processBody, processBodyError) { const successSteps = processBody; @@ -14716,9 +14719,10 @@ var require_formdata = __commonJS({ "use strict"; var { isBlobLike, toUSVString, makeIterator } = require_util2(); var { kState } = require_symbols2(); + var { kEnumerableProperty } = require_util(); var { File: UndiciFile, FileLike, isFileLike } = require_file(); var { webidl } = require_webidl(); - var { Blob: Blob2, File: NativeFile } = require("node:buffer"); + var { File: NativeFile } = require("node:buffer"); var File = NativeFile ?? UndiciFile; var FormData = class _FormData { constructor(form) { @@ -14799,24 +14803,30 @@ var require_formdata = __commonJS({ entries() { webidl.brandCheck(this, _FormData); return makeIterator( - () => this[kState].map((pair) => [pair.name, pair.value]), + () => this[kState], "FormData", - "key+value" + "key+value", + "name", + "value" ); } keys() { webidl.brandCheck(this, _FormData); return makeIterator( - () => this[kState].map((pair) => [pair.name, pair.value]), + () => this[kState], "FormData", - "key" + "key", + "name", + "value" ); } values() { webidl.brandCheck(this, _FormData); return makeIterator( - () => this[kState].map((pair) => [pair.name, pair.value]), + () => this[kState], "FormData", + "value", + "name", "value" ); } @@ -14833,12 +14843,23 @@ var require_formdata = __commonJS({ ); } for (const [key, value] of this) { - callbackFn.apply(thisArg, [value, key, this]); + callbackFn.call(thisArg, value, key, this); } } }; FormData.prototype[Symbol.iterator] = FormData.prototype.entries; Object.defineProperties(FormData.prototype, { + append: kEnumerableProperty, + delete: kEnumerableProperty, + get: kEnumerableProperty, + getAll: kEnumerableProperty, + has: kEnumerableProperty, + set: kEnumerableProperty, + entries: kEnumerableProperty, + keys: kEnumerableProperty, + values: kEnumerableProperty, + forEach: kEnumerableProperty, + [Symbol.iterator]: { enumerable: false }, [Symbol.toStringTag]: { value: "FormData", configurable: true @@ -14850,7 +14871,7 @@ var require_formdata = __commonJS({ value = Buffer.from(value).toString("utf8"); } else { if (!isFileLike(value)) { - value = value instanceof Blob2 ? new File([value], "blob", { type: value.type }) : new FileLike(value, "blob", { type: value.type }); + value = value instanceof Blob ? new File([value], "blob", { type: value.type }) : new FileLike(value, "blob", { type: value.type }); } if (filename !== void 0) { const options = { @@ -21434,50 +21455,32 @@ var require_headers = __commonJS({ } keys() { webidl.brandCheck(this, _Headers); - if (this[kGuard] === "immutable") { - const value = this[kHeadersSortedMap]; - return makeIterator( - () => value, - "Headers", - "key" - ); - } return makeIterator( - () => [...this[kHeadersSortedMap].values()], + () => this[kHeadersSortedMap], "Headers", - "key" + "key", + 0, + 1 ); } values() { webidl.brandCheck(this, _Headers); - if (this[kGuard] === "immutable") { - const value = this[kHeadersSortedMap]; - return makeIterator( - () => value, - "Headers", - "value" - ); - } return makeIterator( - () => [...this[kHeadersSortedMap].values()], + () => this[kHeadersSortedMap], "Headers", - "value" + "value", + 0, + 1 ); } entries() { webidl.brandCheck(this, _Headers); - if (this[kGuard] === "immutable") { - const value = this[kHeadersSortedMap]; - return makeIterator( - () => value, - "Headers", - "key+value" - ); - } return makeIterator( - () => [...this[kHeadersSortedMap].values()], + () => this[kHeadersSortedMap], "Headers", - "key+value" + "key+value", + 0, + 1 ); } /** @@ -21493,7 +21496,7 @@ var require_headers = __commonJS({ ); } for (const [key, value] of this) { - callbackFn.apply(thisArg, [value, key, this]); + callbackFn.call(thisArg, value, key, this); } } [Symbol.for("nodejs.util.inspect.custom")]() { @@ -23146,9 +23149,9 @@ var require_fetch = __commonJS({ internalResponse.body.stream.pipeThrough(transformStream); const byteStream = new ReadableStream({ readableStream: transformStream.readable, - async start(controller) { + async pull(controller) { const reader = this.readableStream.getReader(); - while (true) { + while (controller.desiredSize >= 0) { const { done, value } = await reader.read(); if (done) { queueMicrotask(() => readableStreamClose(controller)); @@ -23157,6 +23160,7 @@ var require_fetch = __commonJS({ controller.enqueue(value); } }, + queuingStrategy: new ByteLengthQueuingStrategy({ highWaterMark: 16384 }), type: "bytes" }); internalResponse.body.stream = byteStream; @@ -23248,6 +23252,7 @@ var require_fetch = __commonJS({ } if (!sameOrigin(requestCurrentURL(request2), locationURL)) { request2.headersList.delete("authorization", true); + request2.headersList.delete("proxy-authorization", true); request2.headersList.delete("cookie", true); request2.headersList.delete("host", true); } @@ -23473,6 +23478,7 @@ var require_fetch = __commonJS({ }; const stream = new ReadableStream( { + highWaterMark: 16384, async start(controller) { fetchParams.controller.controller = controller; }, @@ -23482,7 +23488,8 @@ var require_fetch = __commonJS({ async cancel(reason) { await cancelAlgorithm(reason); }, - type: "bytes" + type: "bytes", + queuingStrategy: new ByteLengthQueuingStrategy({ highWaterMark: 16384 }) } ); response.body = { stream }; @@ -27693,28 +27700,29 @@ async function main(appId2, privateKey2, owner2, repositories2, core3, createApp privateKey: privateKey2, request: request2 }); - let authentication; + let authentication, appSlug; if (parsedRepositoryNames) { - authentication = await pRetry(() => getTokenFromRepository(request2, auth, parsedOwner, parsedRepositoryNames), { + ({ authentication, appSlug } = await pRetry(() => getTokenFromRepository(request2, auth, parsedOwner, parsedRepositoryNames), { onFailedAttempt: (error) => { core3.info( `Failed to create token for "${parsedRepositoryNames}" (attempt ${error.attemptNumber}): ${error.message}` ); }, retries: 3 - }); + })); } else { - authentication = await pRetry(() => getTokenFromOwner(request2, auth, parsedOwner), { + ({ authentication, appSlug } = await pRetry(() => getTokenFromOwner(request2, auth, parsedOwner), { onFailedAttempt: (error) => { core3.info( `Failed to create token for "${parsedOwner}" (attempt ${error.attemptNumber}): ${error.message}` ); }, retries: 3 - }); + })); } core3.setSecret(authentication.token); core3.setOutput("token", authentication.token); + core3.setOutput("app-slug", appSlug); if (!skipTokenRevoke2) { core3.saveState("token", authentication.token); core3.setOutput("expiresAt", authentication.expiresAt); @@ -27740,7 +27748,8 @@ async function getTokenFromOwner(request2, auth, parsedOwner) { type: "installation", installationId: response.data.id }); - return authentication; + const appSlug = response.data["app_slug"]; + return { authentication, appSlug }; } async function getTokenFromRepository(request2, auth, parsedOwner, parsedRepositoryNames) { const response = await request2("GET /repos/{owner}/{repo}/installation", { @@ -27755,7 +27764,8 @@ async function getTokenFromRepository(request2, auth, parsedOwner, parsedReposit installationId: response.data.id, repositoryNames: parsedRepositoryNames.split(",") }); - return authentication; + const appSlug = response.data["app_slug"]; + return { authentication, appSlug }; } // lib/request.js diff --git a/dist/post.cjs b/dist/post.cjs index 5997326..e128ad4 100644 --- a/dist/post.cjs +++ b/dist/post.cjs @@ -6539,15 +6539,16 @@ var require_util2 = __commonJS({ return result; } var esIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())); - function makeIterator(iterator, name, kind) { + function makeIterator(iterator, name, kind, keyIndex = 0, valueIndex = 1) { const object = { index: 0, kind, target: iterator }; - const i = { - next() { - if (Object.getPrototypeOf(this) !== i) { + const iteratorObject = Object.create(esIteratorPrototype); + Object.defineProperty(iteratorObject, "next", { + value: function next() { + if (Object.getPrototypeOf(this) !== iteratorObject) { throw new TypeError( `'next' called on an object that does not implement interface ${name} Iterator.` ); @@ -6558,34 +6559,36 @@ var require_util2 = __commonJS({ if (index >= len) { return { value: void 0, done: true }; } - const pair = values[index]; + const { [keyIndex]: key, [valueIndex]: value } = values[index]; object.index = index + 1; - return iteratorResult(pair, kind2); + let result; + switch (kind2) { + case "key": + result = key; + break; + case "value": + result = value; + break; + case "key+value": + result = [key, value]; + break; + } + return { + value: result, + done: false + }; }, - // The class string of an iterator prototype object for a given interface is the - // result of concatenating the identifier of the interface and the string " Iterator". - [Symbol.toStringTag]: `${name} Iterator` - }; - Object.setPrototypeOf(i, esIteratorPrototype); - return Object.setPrototypeOf({}, i); - } - function iteratorResult(pair, kind) { - let result; - switch (kind) { - case "key": { - result = pair[0]; - break; - } - case "value": { - result = pair[1]; - break; - } - case "key+value": { - result = pair; - break; - } - } - return { value: result, done: false }; + writable: true, + enumerable: true, + configurable: true + }); + Object.defineProperty(iteratorObject, Symbol.toStringTag, { + value: `${name} Iterator`, + writable: false, + enumerable: false, + configurable: true + }); + return Object.create(iteratorObject); } async function fullyReadBody(body, processBody, processBodyError) { const successSteps = processBody; @@ -7455,9 +7458,10 @@ var require_formdata = __commonJS({ "use strict"; var { isBlobLike, toUSVString, makeIterator } = require_util2(); var { kState } = require_symbols2(); + var { kEnumerableProperty } = require_util(); var { File: UndiciFile, FileLike, isFileLike } = require_file(); var { webidl } = require_webidl(); - var { Blob: Blob2, File: NativeFile } = require("node:buffer"); + var { File: NativeFile } = require("node:buffer"); var File = NativeFile ?? UndiciFile; var FormData = class _FormData { constructor(form) { @@ -7538,24 +7542,30 @@ var require_formdata = __commonJS({ entries() { webidl.brandCheck(this, _FormData); return makeIterator( - () => this[kState].map((pair) => [pair.name, pair.value]), + () => this[kState], "FormData", - "key+value" + "key+value", + "name", + "value" ); } keys() { webidl.brandCheck(this, _FormData); return makeIterator( - () => this[kState].map((pair) => [pair.name, pair.value]), + () => this[kState], "FormData", - "key" + "key", + "name", + "value" ); } values() { webidl.brandCheck(this, _FormData); return makeIterator( - () => this[kState].map((pair) => [pair.name, pair.value]), + () => this[kState], "FormData", + "value", + "name", "value" ); } @@ -7572,12 +7582,23 @@ var require_formdata = __commonJS({ ); } for (const [key, value] of this) { - callbackFn.apply(thisArg, [value, key, this]); + callbackFn.call(thisArg, value, key, this); } } }; FormData.prototype[Symbol.iterator] = FormData.prototype.entries; Object.defineProperties(FormData.prototype, { + append: kEnumerableProperty, + delete: kEnumerableProperty, + get: kEnumerableProperty, + getAll: kEnumerableProperty, + has: kEnumerableProperty, + set: kEnumerableProperty, + entries: kEnumerableProperty, + keys: kEnumerableProperty, + values: kEnumerableProperty, + forEach: kEnumerableProperty, + [Symbol.iterator]: { enumerable: false }, [Symbol.toStringTag]: { value: "FormData", configurable: true @@ -7589,7 +7610,7 @@ var require_formdata = __commonJS({ value = Buffer.from(value).toString("utf8"); } else { if (!isFileLike(value)) { - value = value instanceof Blob2 ? new File([value], "blob", { type: value.type }) : new FileLike(value, "blob", { type: value.type }); + value = value instanceof Blob ? new File([value], "blob", { type: value.type }) : new FileLike(value, "blob", { type: value.type }); } if (filename !== void 0) { const options = { @@ -14173,50 +14194,32 @@ var require_headers = __commonJS({ } keys() { webidl.brandCheck(this, _Headers); - if (this[kGuard] === "immutable") { - const value = this[kHeadersSortedMap]; - return makeIterator( - () => value, - "Headers", - "key" - ); - } return makeIterator( - () => [...this[kHeadersSortedMap].values()], + () => this[kHeadersSortedMap], "Headers", - "key" + "key", + 0, + 1 ); } values() { webidl.brandCheck(this, _Headers); - if (this[kGuard] === "immutable") { - const value = this[kHeadersSortedMap]; - return makeIterator( - () => value, - "Headers", - "value" - ); - } return makeIterator( - () => [...this[kHeadersSortedMap].values()], + () => this[kHeadersSortedMap], "Headers", - "value" + "value", + 0, + 1 ); } entries() { webidl.brandCheck(this, _Headers); - if (this[kGuard] === "immutable") { - const value = this[kHeadersSortedMap]; - return makeIterator( - () => value, - "Headers", - "key+value" - ); - } return makeIterator( - () => [...this[kHeadersSortedMap].values()], + () => this[kHeadersSortedMap], "Headers", - "key+value" + "key+value", + 0, + 1 ); } /** @@ -14232,7 +14235,7 @@ var require_headers = __commonJS({ ); } for (const [key, value] of this) { - callbackFn.apply(thisArg, [value, key, this]); + callbackFn.call(thisArg, value, key, this); } } [Symbol.for("nodejs.util.inspect.custom")]() { @@ -15885,9 +15888,9 @@ var require_fetch = __commonJS({ internalResponse.body.stream.pipeThrough(transformStream); const byteStream = new ReadableStream({ readableStream: transformStream.readable, - async start(controller) { + async pull(controller) { const reader = this.readableStream.getReader(); - while (true) { + while (controller.desiredSize >= 0) { const { done, value } = await reader.read(); if (done) { queueMicrotask(() => readableStreamClose(controller)); @@ -15896,6 +15899,7 @@ var require_fetch = __commonJS({ controller.enqueue(value); } }, + queuingStrategy: new ByteLengthQueuingStrategy({ highWaterMark: 16384 }), type: "bytes" }); internalResponse.body.stream = byteStream; @@ -15987,6 +15991,7 @@ var require_fetch = __commonJS({ } if (!sameOrigin(requestCurrentURL(request2), locationURL)) { request2.headersList.delete("authorization", true); + request2.headersList.delete("proxy-authorization", true); request2.headersList.delete("cookie", true); request2.headersList.delete("host", true); } @@ -16212,6 +16217,7 @@ var require_fetch = __commonJS({ }; const stream = new ReadableStream( { + highWaterMark: 16384, async start(controller) { fetchParams.controller.controller = controller; }, @@ -16221,7 +16227,8 @@ var require_fetch = __commonJS({ async cancel(reason) { await cancelAlgorithm(reason); }, - type: "bytes" + type: "bytes", + queuingStrategy: new ByteLengthQueuingStrategy({ highWaterMark: 16384 }) } ); response.body = { stream }; diff --git a/lib/main.js b/lib/main.js index b97329d..6267344 100644 --- a/lib/main.js +++ b/lib/main.js @@ -70,35 +70,35 @@ export async function main( request, }); - let authentication; + let authentication, appSlug; // If at least one repository is set, get installation ID from that repository if (parsedRepositoryNames) { - authentication = await pRetry(() => getTokenFromRepository(request, auth, parsedOwner, parsedRepositoryNames), { + ({ authentication, appSlug } = await pRetry(() => getTokenFromRepository(request, auth, parsedOwner, parsedRepositoryNames), { onFailedAttempt: (error) => { core.info( `Failed to create token for "${parsedRepositoryNames}" (attempt ${error.attemptNumber}): ${error.message}` ); }, retries: 3, - }); - + })); } else { // Otherwise get the installation for the owner, which can either be an organization or a user account - authentication = await pRetry(() => getTokenFromOwner(request, auth, parsedOwner), { + ({ authentication, appSlug } = await pRetry(() => getTokenFromOwner(request, auth, parsedOwner), { onFailedAttempt: (error) => { core.info( `Failed to create token for "${parsedOwner}" (attempt ${error.attemptNumber}): ${error.message}` ); }, retries: 3, - }); + })); } // Register the token with the runner as a secret to ensure it is masked in logs core.setSecret(authentication.token); core.setOutput("token", authentication.token); + core.setOutput("app-slug", appSlug); // Make token accessible to post function (so we can invalidate it) if (!skipTokenRevoke) { @@ -132,7 +132,10 @@ async function getTokenFromOwner(request, auth, parsedOwner) { type: "installation", installationId: response.data.id, }); - return authentication; + + const appSlug = response.data['app_slug']; + + return { authentication, appSlug }; } async function getTokenFromRepository(request, auth, parsedOwner, parsedRepositoryNames) { @@ -152,5 +155,7 @@ async function getTokenFromRepository(request, auth, parsedOwner, parsedReposito repositoryNames: parsedRepositoryNames.split(","), }); - return authentication; -} \ No newline at end of file + const appSlug = response.data['app_slug']; + + return { authentication, appSlug }; + } \ No newline at end of file diff --git a/tests/main-repo-skew.js b/tests/main-repo-skew.js index a3554ad..e35a531 100644 --- a/tests/main-repo-skew.js +++ b/tests/main-repo-skew.js @@ -9,6 +9,7 @@ await test((mockPool) => { const owner = process.env.INPUT_OWNER const repo = process.env.INPUT_REPOSITORIES const mockInstallationId = "123456"; + const mockAppSlug = "github-actions"; install({ now: 0, toFake: ["Date"] }); @@ -44,7 +45,8 @@ await test((mockPool) => { return { statusCode: 200, data: { - id: mockInstallationId + id: mockInstallationId, + "app_slug": mockAppSlug }, responseOptions: { headers: { diff --git a/tests/main-token-get-owner-set-repo-fail-response.test.js b/tests/main-token-get-owner-set-repo-fail-response.test.js index 14c5811..f97cf26 100644 --- a/tests/main-token-get-owner-set-repo-fail-response.test.js +++ b/tests/main-token-get-owner-set-repo-fail-response.test.js @@ -7,6 +7,7 @@ await test((mockPool) => { const owner = process.env.INPUT_OWNER; const repo = process.env.INPUT_REPOSITORIES; const mockInstallationId = "123456"; + const mockAppSlug = "github-actions"; mockPool .intercept({ @@ -32,7 +33,7 @@ await test((mockPool) => { }) .reply( 200, - { id: mockInstallationId }, + { id: mockInstallationId, "app_slug": mockAppSlug }, { headers: { "content-type": "application/json" } } ); }); diff --git a/tests/main-token-get-owner-set-to-org-repo-unset.test.js b/tests/main-token-get-owner-set-to-org-repo-unset.test.js index 1fa0e1f..87245f7 100644 --- a/tests/main-token-get-owner-set-to-org-repo-unset.test.js +++ b/tests/main-token-get-owner-set-to-org-repo-unset.test.js @@ -5,8 +5,9 @@ await test((mockPool) => { process.env.INPUT_OWNER = process.env.GITHUB_REPOSITORY_OWNER; delete process.env.INPUT_REPOSITORIES; - // Mock installation id request + // Mock installation id and app slug request const mockInstallationId = "123456"; + const mockAppSlug = "github-actions"; mockPool .intercept({ path: `/orgs/${process.env.INPUT_OWNER}/installation`, @@ -19,7 +20,7 @@ await test((mockPool) => { }) .reply( 200, - { id: mockInstallationId }, + { id: mockInstallationId, "app_slug": mockAppSlug }, { headers: { "content-type": "application/json" } } ); }); diff --git a/tests/main-token-get-owner-set-to-user-fail-response.test.js b/tests/main-token-get-owner-set-to-user-fail-response.test.js index e9fba9b..663b32f 100644 --- a/tests/main-token-get-owner-set-to-user-fail-response.test.js +++ b/tests/main-token-get-owner-set-to-user-fail-response.test.js @@ -5,8 +5,9 @@ await test((mockPool) => { process.env.INPUT_OWNER = "smockle"; delete process.env.INPUT_REPOSITORIES; - // Mock installation id request + // Mock installation id and app slug request const mockInstallationId = "123456"; + const mockAppSlug = "github-actions"; mockPool .intercept({ path: `/orgs/${process.env.INPUT_OWNER}/installation`, @@ -30,7 +31,7 @@ await test((mockPool) => { }) .reply( 200, - { id: mockInstallationId }, + { id: mockInstallationId, "app_slug": mockAppSlug }, { headers: { "content-type": "application/json" } } ); }); diff --git a/tests/main-token-get-owner-set-to-user-repo-unset.test.js b/tests/main-token-get-owner-set-to-user-repo-unset.test.js index bbb802c..6ea0265 100644 --- a/tests/main-token-get-owner-set-to-user-repo-unset.test.js +++ b/tests/main-token-get-owner-set-to-user-repo-unset.test.js @@ -5,8 +5,9 @@ await test((mockPool) => { process.env.INPUT_OWNER = "smockle"; delete process.env.INPUT_REPOSITORIES; - // Mock installation id request + // Mock installation id and app slug request const mockInstallationId = "123456"; + const mockAppSlug = "github-actions"; mockPool .intercept({ path: `/orgs/${process.env.INPUT_OWNER}/installation`, @@ -30,7 +31,7 @@ await test((mockPool) => { }) .reply( 200, - { id: mockInstallationId }, + { id: mockInstallationId, "app_slug": mockAppSlug }, { headers: { "content-type": "application/json" } } ); }); diff --git a/tests/main-token-get-owner-unset-repo-unset.test.js b/tests/main-token-get-owner-unset-repo-unset.test.js index ccc20dd..7e9217a 100644 --- a/tests/main-token-get-owner-unset-repo-unset.test.js +++ b/tests/main-token-get-owner-unset-repo-unset.test.js @@ -5,8 +5,9 @@ await test((mockPool) => { delete process.env.INPUT_OWNER; delete process.env.INPUT_REPOSITORIES; - // Mock installation id request + // Mock installation id and app slug request const mockInstallationId = "123456"; + const mockAppSlug = "github-actions"; mockPool .intercept({ path: `/repos/${process.env.GITHUB_REPOSITORY}/installation`, @@ -19,7 +20,7 @@ await test((mockPool) => { }) .reply( 200, - { id: mockInstallationId }, + { id: mockInstallationId, "app_slug": mockAppSlug }, { headers: { "content-type": "application/json" } } ); }); diff --git a/tests/main.js b/tests/main.js index eb755b7..d8e6985 100644 --- a/tests/main.js +++ b/tests/main.js @@ -54,8 +54,9 @@ export async function test(cb = (_mockPool) => {}, env = DEFAULT_ENV) { // Calling `auth({ type: "app" })` to obtain a JWT doesn’t make network requests, so no need to intercept. - // Mock installation id request + // Mock installation id and app slug request const mockInstallationId = "123456"; + const mockAppSlug = "github-actions"; const owner = env.INPUT_OWNER ?? env.GITHUB_REPOSITORY_OWNER; const repo = encodeURIComponent( (env.INPUT_REPOSITORIES ?? env.GITHUB_REPOSITORY).split(",")[0] @@ -72,7 +73,7 @@ export async function test(cb = (_mockPool) => {}, env = DEFAULT_ENV) { }) .reply( 200, - { id: mockInstallationId }, + { id: mockInstallationId, "app_slug": mockAppSlug }, { headers: { "content-type": "application/json" } } ); From a22f5cf3d46a3582cb82e830181c074ad2e84cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=99=E6=BC=A0=E4=B9=8B=E5=AD=90?= <7850715+maboloshi@users.noreply.github.com> Date: Thu, 22 Feb 2024 10:19:40 +0800 Subject: [PATCH 2/5] Update snapshot files --- tests/snapshots/index.js.md | 130 +++++++++++++++++++--------------- tests/snapshots/index.js.snap | Bin 1081 -> 1105 bytes 2 files changed, 74 insertions(+), 56 deletions(-) diff --git a/tests/snapshots/index.js.md b/tests/snapshots/index.js.md index b42248a..0bb9ae7 100644 --- a/tests/snapshots/index.js.md +++ b/tests/snapshots/index.js.md @@ -24,12 +24,14 @@ Generated by [AVA](https://avajs.dev). > stdout - `owner and repositories set, creating token for repositories "actions/create-github-app-token" owned by "actions"␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ + `owner and repositories set, creating token for repositories "actions/create-github-app-token" owned by "actions"␍␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=app-slug::github-actions␍␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-missing-app-id.test.js @@ -80,13 +82,15 @@ Generated by [AVA](https://avajs.dev). > stdout - `owner and repositories set, creating token for repositories "failed-repo" owned by "actions"␊ - Failed to create token for "failed-repo" (attempt 1): GitHub API not available␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ + `owner and repositories set, creating token for repositories "failed-repo" owned by "actions"␍␊ + Failed to create token for "failed-repo" (attempt 1): GitHub API not available␍␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=app-slug::github-actions␍␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-token-get-owner-set-repo-set-to-many.test.js @@ -97,12 +101,14 @@ Generated by [AVA](https://avajs.dev). > stdout - `owner and repositories set, creating token for repositories "actions/create-github-app-token,actions/toolkit" owned by "actions"␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ + `owner and repositories set, creating token for repositories "actions/create-github-app-token,actions/toolkit" owned by "actions"␍␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=app-slug::github-actions␍␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-token-get-owner-set-repo-set-to-one.test.js @@ -113,12 +119,14 @@ Generated by [AVA](https://avajs.dev). > stdout - `owner and repositories set, creating token for repositories "actions/create-github-app-token" owned by "actions"␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ + `owner and repositories set, creating token for repositories "actions/create-github-app-token" owned by "actions"␍␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=app-slug::github-actions␍␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-token-get-owner-set-to-org-repo-unset.test.js @@ -129,12 +137,14 @@ Generated by [AVA](https://avajs.dev). > stdout - `repositories not set, creating token for all repositories for given owner "actions"␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ + `repositories not set, creating token for all repositories for given owner "actions"␍␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=app-slug::github-actions␍␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-token-get-owner-set-to-user-fail-response.test.js @@ -145,13 +155,15 @@ Generated by [AVA](https://avajs.dev). > stdout - `repositories not set, creating token for all repositories for given owner "smockle"␊ - Failed to create token for "smockle" (attempt 1): GitHub API not available␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ + `repositories not set, creating token for all repositories for given owner "smockle"␍␊ + Failed to create token for "smockle" (attempt 1): GitHub API not available␍␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=app-slug::github-actions␍␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-token-get-owner-set-to-user-repo-unset.test.js @@ -162,12 +174,14 @@ Generated by [AVA](https://avajs.dev). > stdout - `repositories not set, creating token for all repositories for given owner "smockle"␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ + `repositories not set, creating token for all repositories for given owner "smockle"␍␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=app-slug::github-actions␍␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-token-get-owner-unset-repo-set.test.js @@ -178,12 +192,14 @@ Generated by [AVA](https://avajs.dev). > stdout - `owner not set, creating owner for given repositories "actions/create-github-app-token" in current owner ("actions")␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ + `owner not set, creating owner for given repositories "actions/create-github-app-token" in current owner ("actions")␍␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=app-slug::github-actions␍␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-token-get-owner-unset-repo-unset.test.js @@ -194,12 +210,14 @@ Generated by [AVA](https://avajs.dev). > stdout - `owner and repositories not set, creating token for the current repository ("create-github-app-token")␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ - ␊ + `owner and repositories not set, creating token for the current repository ("create-github-app-token")␍␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ + ::set-output name=app-slug::github-actions␍␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ + ␍␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## post-revoke-token-fail-response.test.js diff --git a/tests/snapshots/index.js.snap b/tests/snapshots/index.js.snap index 46c364e9f519d9da66f3532f78903a7714b686ca..95d1c75324f5d41c3f0300d4b17fd6a8d2242f05 100644 GIT binary patch literal 1105 zcmV-X1g`r*RzV5;U{xKcjf#*6T_|vaeR_+3$RN z&Tq~h&9h!NlEFa#@*I$31dj;|kV`>BNE8GNA*5U+De5f*ja%Ppt_4fg+6UB!Np)-IdS(K?8j&f1x{G>+?43H19X}nn7#NYaX=QUL)Au-re45?}OLg zy|=?Q*3EMokjfO36p3Ild}@P~6)|pgl=gjpWIuCi*Rml{jSOLl0pW4N73h8R{bs{! z(MFqk-dVHhdpo|@_+};yH!Tb?*P4qy&2~&71?Qhk*SJzUHZ6cC_%7ut$5u!rI!%&@ zL+F!CZw4+!JWV-!&v9mHDmHfL7~4BMK0A7NuXB3v;N+|0vy;JUAt}TAjqH zMzgy#AVEoLcdhEw~Q+Yt;5+p>b_lIvXr&9 zDJA#eO@;_@g2cP+lS7V2X_xFjIJQ`@A>$G2MzHF6i}XD2da}#~N*Xg!yg6Qgt3MpB zp1soVVSV&JN*N6}uD*}UVx{pytVmI+1+7M>|05dBLNp8!D*MRNRA|65aQx`Nffc9P zc1S3|f<=*whPm12Ll7hbY*qhK^>1BQ|5Sro-i-3M!@!@*WI)F<7(_5~0C;%-KAs7Ht@n7^C{y^~ox(rO$Be5L&+bo(`;zko7bHlP0)e^G z=J-Q%dj-ZKV9SE%)DiDWhYF(;LBa6J=(hUZ@-h8=y%% zKB8$)BqNA>494=miF#?dUTg)2H5@MBat711Cz+UNxfT%`V?W~}iSUq$v#gIvN^!=* zI%=rZrY&v?)2eA$I9_o2Jv`kfue-RpLpw!gi(y}8xh1*g0HV2iBE zUr9z-rboIN#Uz5ybc9!ckO*W9mJNt(x2ag~0j`toNeRFtnbo``u^zGMs$0$c@p-4JeRflo_vpg*l1^jp0iq*%#0rxr{5%|m@(CCPND86f+&>qH2MQh}Vi z9@?kkAnT*uM~B)KWGr`*ehAC<<;*vUx)6y>P+aZvD_G=(Ws&G#9aF8zeUT*Lh>GRd zD$~7vCEb&_R%ckgoxEIi*g3H?RGQclm|3W^R&#kyuPuK{=22;&o`+jkK{LQ2=gcTWYcnrU(FiTuX+<}{O9Yu@WuaL z%uhaH3je_+dCmz(d6ZH%@6E8O*$7TQw79%$xX_~Tt@wWfez}`4gBSn+w`LNI From 36eed156b767c6d94c65f95b2557bbad3805a966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=99=E6=BC=A0=E4=B9=8B=E5=AD=90?= <7850715+maboloshi@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:33:26 +0800 Subject: [PATCH 3/5] feat: add GitHub App's installation Id output --- README.md | 4 ++++ action.yml | 2 ++ dist/main.cjs | 13 ++++++++----- lib/main.js | 13 ++++++++----- tests/snapshots/index.js.md | 18 ++++++++++++++++++ tests/snapshots/index.js.snap | Bin 1105 -> 1130 bytes 6 files changed, 40 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 37f400f..57bb820 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,10 @@ jobs: GitHub App installation access token. +### `installation-id` + +GitHub App's installation Id. + ### `app-slug` GitHub App's slug. diff --git a/action.yml b/action.yml index 5a6d85b..f5b7cb7 100644 --- a/action.yml +++ b/action.yml @@ -40,6 +40,8 @@ inputs: outputs: token: description: "GitHub installation access token" + installation-id: + description: "GitHub App's installation Id" app-slug: description: "GitHub App's slug" runs: diff --git a/dist/main.cjs b/dist/main.cjs index ad1529e..cb75b70 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -27700,9 +27700,9 @@ async function main(appId2, privateKey2, owner2, repositories2, core3, createApp privateKey: privateKey2, request: request2 }); - let authentication, appSlug; + let authentication, installationId, appSlug; if (parsedRepositoryNames) { - ({ authentication, appSlug } = await pRetry(() => getTokenFromRepository(request2, auth, parsedOwner, parsedRepositoryNames), { + ({ authentication, installationId, appSlug } = await pRetry(() => getTokenFromRepository(request2, auth, parsedOwner, parsedRepositoryNames), { onFailedAttempt: (error) => { core3.info( `Failed to create token for "${parsedRepositoryNames}" (attempt ${error.attemptNumber}): ${error.message}` @@ -27711,7 +27711,7 @@ async function main(appId2, privateKey2, owner2, repositories2, core3, createApp retries: 3 })); } else { - ({ authentication, appSlug } = await pRetry(() => getTokenFromOwner(request2, auth, parsedOwner), { + ({ authentication, installationId, appSlug } = await pRetry(() => getTokenFromOwner(request2, auth, parsedOwner), { onFailedAttempt: (error) => { core3.info( `Failed to create token for "${parsedOwner}" (attempt ${error.attemptNumber}): ${error.message}` @@ -27722,6 +27722,7 @@ async function main(appId2, privateKey2, owner2, repositories2, core3, createApp } core3.setSecret(authentication.token); core3.setOutput("token", authentication.token); + core3.setOutput("installation-id", installationId); core3.setOutput("app-slug", appSlug); if (!skipTokenRevoke2) { core3.saveState("token", authentication.token); @@ -27748,8 +27749,9 @@ async function getTokenFromOwner(request2, auth, parsedOwner) { type: "installation", installationId: response.data.id }); + const installationId = response.data.id; const appSlug = response.data["app_slug"]; - return { authentication, appSlug }; + return { authentication, installationId, appSlug }; } async function getTokenFromRepository(request2, auth, parsedOwner, parsedRepositoryNames) { const response = await request2("GET /repos/{owner}/{repo}/installation", { @@ -27764,8 +27766,9 @@ async function getTokenFromRepository(request2, auth, parsedOwner, parsedReposit installationId: response.data.id, repositoryNames: parsedRepositoryNames.split(",") }); + const installationId = response.data.id; const appSlug = response.data["app_slug"]; - return { authentication, appSlug }; + return { authentication, installationId, appSlug }; } // lib/request.js diff --git a/lib/main.js b/lib/main.js index 6267344..d685277 100644 --- a/lib/main.js +++ b/lib/main.js @@ -70,11 +70,11 @@ export async function main( request, }); - let authentication, appSlug; + let authentication, installationId, appSlug; // If at least one repository is set, get installation ID from that repository if (parsedRepositoryNames) { - ({ authentication, appSlug } = await pRetry(() => getTokenFromRepository(request, auth, parsedOwner, parsedRepositoryNames), { + ({ authentication, installationId, appSlug } = await pRetry(() => getTokenFromRepository(request, auth, parsedOwner, parsedRepositoryNames), { onFailedAttempt: (error) => { core.info( `Failed to create token for "${parsedRepositoryNames}" (attempt ${error.attemptNumber}): ${error.message}` @@ -84,7 +84,7 @@ export async function main( })); } else { // Otherwise get the installation for the owner, which can either be an organization or a user account - ({ authentication, appSlug } = await pRetry(() => getTokenFromOwner(request, auth, parsedOwner), { + ({ authentication, installationId, appSlug } = await pRetry(() => getTokenFromOwner(request, auth, parsedOwner), { onFailedAttempt: (error) => { core.info( `Failed to create token for "${parsedOwner}" (attempt ${error.attemptNumber}): ${error.message}` @@ -98,6 +98,7 @@ export async function main( core.setSecret(authentication.token); core.setOutput("token", authentication.token); + core.setOutput("installation-id", installationId); core.setOutput("app-slug", appSlug); // Make token accessible to post function (so we can invalidate it) @@ -133,9 +134,10 @@ async function getTokenFromOwner(request, auth, parsedOwner) { installationId: response.data.id, }); + const installationId = response.data.id; const appSlug = response.data['app_slug']; - return { authentication, appSlug }; + return { authentication, installationId, appSlug }; } async function getTokenFromRepository(request, auth, parsedOwner, parsedRepositoryNames) { @@ -155,7 +157,8 @@ async function getTokenFromRepository(request, auth, parsedOwner, parsedReposito repositoryNames: parsedRepositoryNames.split(","), }); + const installationId = response.data.id; const appSlug = response.data['app_slug']; - return { authentication, appSlug }; + return { authentication, installationId, appSlug }; } \ No newline at end of file diff --git a/tests/snapshots/index.js.md b/tests/snapshots/index.js.md index 0bb9ae7..4a7486c 100644 --- a/tests/snapshots/index.js.md +++ b/tests/snapshots/index.js.md @@ -29,6 +29,8 @@ Generated by [AVA](https://avajs.dev). ␍␊ ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ + ::set-output name=installation-id::123456␍␊ + ␍␊ ::set-output name=app-slug::github-actions␍␊ ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ @@ -88,6 +90,8 @@ Generated by [AVA](https://avajs.dev). ␍␊ ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ + ::set-output name=installation-id::123456␍␊ + ␍␊ ::set-output name=app-slug::github-actions␍␊ ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ @@ -106,6 +110,8 @@ Generated by [AVA](https://avajs.dev). ␍␊ ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ + ::set-output name=installation-id::123456␍␊ + ␍␊ ::set-output name=app-slug::github-actions␍␊ ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ @@ -124,6 +130,8 @@ Generated by [AVA](https://avajs.dev). ␍␊ ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ + ::set-output name=installation-id::123456␍␊ + ␍␊ ::set-output name=app-slug::github-actions␍␊ ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ @@ -142,6 +150,8 @@ Generated by [AVA](https://avajs.dev). ␍␊ ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ + ::set-output name=installation-id::123456␍␊ + ␍␊ ::set-output name=app-slug::github-actions␍␊ ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ @@ -161,6 +171,8 @@ Generated by [AVA](https://avajs.dev). ␍␊ ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ + ::set-output name=installation-id::123456␍␊ + ␍␊ ::set-output name=app-slug::github-actions␍␊ ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ @@ -179,6 +191,8 @@ Generated by [AVA](https://avajs.dev). ␍␊ ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ + ::set-output name=installation-id::123456␍␊ + ␍␊ ::set-output name=app-slug::github-actions␍␊ ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ @@ -197,6 +211,8 @@ Generated by [AVA](https://avajs.dev). ␍␊ ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ + ::set-output name=installation-id::123456␍␊ + ␍␊ ::set-output name=app-slug::github-actions␍␊ ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ @@ -215,6 +231,8 @@ Generated by [AVA](https://avajs.dev). ␍␊ ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ + ::set-output name=installation-id::123456␍␊ + ␍␊ ::set-output name=app-slug::github-actions␍␊ ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ ␍␊ diff --git a/tests/snapshots/index.js.snap b/tests/snapshots/index.js.snap index 95d1c75324f5d41c3f0300d4b17fd6a8d2242f05..39c1f84a935b00bb9ac3867ffc3fb2a2997412e1 100644 GIT binary patch literal 1130 zcmV-w1eNS)K>uM=1Md>U$qS7t6sI?zUuQ2&Zon z!`UYvEFX&q00000000B+na^(6`~!#s+S&DwQM_@<#!w;qv|5k9 z?>lck^X6&%wATq$cVNDG1}HFu$AouLC`ki|HFP;bK!uDGG#dy8H@+~!NFJLrh34yL zLBNrJ{L;!RE9s~5^2+Ng5b_R$J%a&goeg+Y;nPEI99MW8w?#mH|LR*(%bsgQ7&3`T zxD3d-2t(2Vq9Ia42#An`lU{;}1~LR~gpwQNp#iHwt%fuRJlI%`wHR`Q_5hw_QKnv$ z3zZAeOlTC(3`E>UH2~SxFjND`qF#7iE_NzMtsEW8z4l2kn)ohRd=)wNZ|co5Ktn*n3}Gt>5(AGM(2-}iU?Zga=;_gXD)v%9^uz13*# zg4f!<*Whcb>F*36RSCuk63HX@zy>KRk}d)dLvA;Y2pIGHt;U_^?7`{OOqlc;8_hMF zmL1E7Kn-$)Yjg*XW1+$9B4hrh*QA>*>Uk%=&%6fnHb0+9&P_{BB#aTVPqXb+h|KAo zX&@@K!?a!y4PPcg=Zs5*#3XSX3J4g<^k%SC1mBdiHyvjdy<%hgjb8U17nNL+|kBg9MFtL&bN))*p zuR2BU&vHdBbp?TSIJ=U-up|cb zwe?k%zZ_uxxK3b9q`HF;=Co6zQOj291%a=)qaVTd!k4NEc}rRrOw0Q-X|ZsOJESs{ z{OVBhW8NBF#3Oq@A>kkPL_(5oqBTg&mDb1S-K`}>3#W+Aqo{PX`N`qv`=S>6vbuw3 zFotAuGeg#^MN}=xSv)zlSQ*T(-*bSjsW&?Hotw3H89V1%3fX7u#4?cv?b=k5>`sW0 z*;l02V&*NIV)5PWd{<4!)p}+nm#vfZFNt`9?Zo0NXTvFDrMB1UO~=&QBtHWP=H|qD wE|rt_obYd5Se|okNFHUTn>VK1l&mzTZ#!OI%e;tjWpU#F4Od^fM(!H`0Aku5!~g&Q literal 1105 zcmV-X1g`r*RzV5;U{xKcjf#*6T_|vaeR_+3$RN z&Tq~h&9h!NlEFa#@*I$31dj;|kV`>BNE8GNA*5U+De5f*ja%Ppt_4fg+6UB!Np)-IdS(K?8j&f1x{G>+?43H19X}nn7#NYaX=QUL)Au-re45?}OLg zy|=?Q*3EMokjfO36p3Ild}@P~6)|pgl=gjpWIuCi*Rml{jSOLl0pW4N73h8R{bs{! z(MFqk-dVHhdpo|@_+};yH!Tb?*P4qy&2~&71?Qhk*SJzUHZ6cC_%7ut$5u!rI!%&@ zL+F!CZw4+!JWV-!&v9mHDmHfL7~4BMK0A7NuXB3v;N+|0vy;JUAt}TAjqH zMzgy#AVEoLcdhEw~Q+Yt;5+p>b_lIvXr&9 zDJA#eO@;_@g2cP+lS7V2X_xFjIJQ`@A>$G2MzHF6i}XD2da}#~N*Xg!yg6Qgt3MpB zp1soVVSV&JN*N6}uD*}UVx{pytVmI+1+7M>|05dBLNp8!D*MRNRA|65aQx`Nffc9P zc1S3|f<=*whPm12Ll7hbY*qhK^>1BQ|5Sro-i-3M!@!@*WI)F<7(_5~0C;%-KAs7Ht@n7^C{y^~ox(rO$Be5L&+bo(`;zko7bHlP0)e^G z=J-Q%dj-ZKV9SE%)Di Date: Thu, 22 Feb 2024 14:28:25 +0800 Subject: [PATCH 4/5] =?UTF-8?q?Update=20snapshot=20files=EF=BC=88Resolved?= =?UTF-8?q?=20Line=20Break=20Styles=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/snapshots/index.js.md | 184 +++++++++++++++++----------------- tests/snapshots/index.js.snap | Bin 1130 -> 1131 bytes 2 files changed, 92 insertions(+), 92 deletions(-) diff --git a/tests/snapshots/index.js.md b/tests/snapshots/index.js.md index 4a7486c..21918c0 100644 --- a/tests/snapshots/index.js.md +++ b/tests/snapshots/index.js.md @@ -24,16 +24,16 @@ Generated by [AVA](https://avajs.dev). > stdout - `owner and repositories set, creating token for repositories "actions/create-github-app-token" owned by "actions"␍␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=installation-id::123456␍␊ - ␍␊ - ::set-output name=app-slug::github-actions␍␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ + `owner and repositories set, creating token for repositories "actions/create-github-app-token" owned by "actions"␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=installation-id::123456␊ + ␊ + ::set-output name=app-slug::github-actions␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-missing-app-id.test.js @@ -84,17 +84,17 @@ Generated by [AVA](https://avajs.dev). > stdout - `owner and repositories set, creating token for repositories "failed-repo" owned by "actions"␍␊ - Failed to create token for "failed-repo" (attempt 1): GitHub API not available␍␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=installation-id::123456␍␊ - ␍␊ - ::set-output name=app-slug::github-actions␍␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ + `owner and repositories set, creating token for repositories "failed-repo" owned by "actions"␊ + Failed to create token for "failed-repo" (attempt 1): GitHub API not available␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=installation-id::123456␊ + ␊ + ::set-output name=app-slug::github-actions␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-token-get-owner-set-repo-set-to-many.test.js @@ -105,16 +105,16 @@ Generated by [AVA](https://avajs.dev). > stdout - `owner and repositories set, creating token for repositories "actions/create-github-app-token,actions/toolkit" owned by "actions"␍␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=installation-id::123456␍␊ - ␍␊ - ::set-output name=app-slug::github-actions␍␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ + `owner and repositories set, creating token for repositories "actions/create-github-app-token,actions/toolkit" owned by "actions"␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=installation-id::123456␊ + ␊ + ::set-output name=app-slug::github-actions␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-token-get-owner-set-repo-set-to-one.test.js @@ -125,16 +125,16 @@ Generated by [AVA](https://avajs.dev). > stdout - `owner and repositories set, creating token for repositories "actions/create-github-app-token" owned by "actions"␍␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=installation-id::123456␍␊ - ␍␊ - ::set-output name=app-slug::github-actions␍␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ + `owner and repositories set, creating token for repositories "actions/create-github-app-token" owned by "actions"␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=installation-id::123456␊ + ␊ + ::set-output name=app-slug::github-actions␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-token-get-owner-set-to-org-repo-unset.test.js @@ -145,16 +145,16 @@ Generated by [AVA](https://avajs.dev). > stdout - `repositories not set, creating token for all repositories for given owner "actions"␍␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=installation-id::123456␍␊ - ␍␊ - ::set-output name=app-slug::github-actions␍␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ + `repositories not set, creating token for all repositories for given owner "actions"␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=installation-id::123456␊ + ␊ + ::set-output name=app-slug::github-actions␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-token-get-owner-set-to-user-fail-response.test.js @@ -165,17 +165,17 @@ Generated by [AVA](https://avajs.dev). > stdout - `repositories not set, creating token for all repositories for given owner "smockle"␍␊ - Failed to create token for "smockle" (attempt 1): GitHub API not available␍␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=installation-id::123456␍␊ - ␍␊ - ::set-output name=app-slug::github-actions␍␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ + `repositories not set, creating token for all repositories for given owner "smockle"␊ + Failed to create token for "smockle" (attempt 1): GitHub API not available␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=installation-id::123456␊ + ␊ + ::set-output name=app-slug::github-actions␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-token-get-owner-set-to-user-repo-unset.test.js @@ -186,16 +186,16 @@ Generated by [AVA](https://avajs.dev). > stdout - `repositories not set, creating token for all repositories for given owner "smockle"␍␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=installation-id::123456␍␊ - ␍␊ - ::set-output name=app-slug::github-actions␍␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ + `repositories not set, creating token for all repositories for given owner "smockle"␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=installation-id::123456␊ + ␊ + ::set-output name=app-slug::github-actions␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-token-get-owner-unset-repo-set.test.js @@ -206,16 +206,16 @@ Generated by [AVA](https://avajs.dev). > stdout - `owner not set, creating owner for given repositories "actions/create-github-app-token" in current owner ("actions")␍␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=installation-id::123456␍␊ - ␍␊ - ::set-output name=app-slug::github-actions␍␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ + `owner not set, creating owner for given repositories "actions/create-github-app-token" in current owner ("actions")␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=installation-id::123456␊ + ␊ + ::set-output name=app-slug::github-actions␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## main-token-get-owner-unset-repo-unset.test.js @@ -226,16 +226,16 @@ Generated by [AVA](https://avajs.dev). > stdout - `owner and repositories not set, creating token for the current repository ("create-github-app-token")␍␊ - ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ - ::set-output name=installation-id::123456␍␊ - ␍␊ - ::set-output name=app-slug::github-actions␍␊ - ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␍␊ - ␍␊ + `owner and repositories not set, creating token for the current repository ("create-github-app-token")␊ + ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ + ::set-output name=installation-id::123456␊ + ␊ + ::set-output name=app-slug::github-actions␊ + ::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊ + ␊ ::set-output name=expiresAt::2016-07-11T22:14:10Z` ## post-revoke-token-fail-response.test.js diff --git a/tests/snapshots/index.js.snap b/tests/snapshots/index.js.snap index 39c1f84a935b00bb9ac3867ffc3fb2a2997412e1..53720f3db20c1a6b28f5ab5d2b11dba78c399cea 100644 GIT binary patch literal 1131 zcmV-x1eE(hRzV(EQxUlDTjbc2r-M(Oo}ZDLT-I7n22dA&J!uV zdJ=|I(vMzTdwETNDle_QwgwUHK-3j71kSC&!wQ`?dEul&)3nV(^z_SbP}M$H5ff+< z6VW(C7c7cU2M~urGE`$MMig~3nQ=fv;6lmVLJtHOAK3Vag#;RIt*4v~m7jJW9@{8W z1LZ>Hj<9t!iYNLkZOfz&ahtifiN5U>8(OkQpnUIt7EwPM(AszOlC zZck%SsUGPnp%(XxOvSZi$B9HDOVfx!NRah6gQz0prj)(mC^Ntn3p;Rx?H(MR9zM9+ zKH0y2{K?Vj@yWyX@uwf}pP<}Z4Gq)=(Hl^uP+^LycZ~lJs#lYW9H~>~qF69-1lJa3 za?0t|G`{U<9B;@u5)U1TFa6IwNI>>*Isd#vPeCNRBb0H zQ`-J=O4}dhN}E=tj!!)}vy9y{?{$)F@tbnw{&tf}34>H3?v zl6E3kRmCM$MQ=WP`avct?{V?=c?R-+cgXv7sfTK9^j;=O)Ms*a$UaA$>d%Bz5|^rD zs}}8lN{?SikA{ZZ!yISo7?frB`QG8@+lm8(X+{djQHgfx(StoURIe?AD@2x!NOK+{ znNZKy)-L_&VDj`jF%g3#=tnTWOBxxiI;4M`7MBIPADvfblF|r&+-kZsYL1Nta zlwspHhmD`|j^{EIc6_q_|FG3zF$yxyA(pwP&GCVDbH&b**ujg~DP389cIf$`s9&B} zW8^uE(U{z*C_ail58=X` x7|o?}@~#v9%}dL3K?TaA%vAIGl$w(DS)K>uM=1Md>U$qS7t6sI?zUuQ2&Zon z!`UYvEFX&q00000000B+na^(6`~!#s+S&DwQM_@<#!w;qv|5k9 z?>lck^X6&%wATq$cVNDG1}HFu$AouLC`ki|HFP;bK!uDGG#dy8H@+~!NFJLrh34yL zLBNrJ{L;!RE9s~5^2+Ng5b_R$J%a&goeg+Y;nPEI99MW8w?#mH|LR*(%bsgQ7&3`T zxD3d-2t(2Vq9Ia42#An`lU{;}1~LR~gpwQNp#iHwt%fuRJlI%`wHR`Q_5hw_QKnv$ z3zZAeOlTC(3`E>UH2~SxFjND`qF#7iE_NzMtsEW8z4l2kn)ohRd=)wNZ|co5Ktn*n3}Gt>5(AGM(2-}iU?Zga=;_gXD)v%9^uz13*# zg4f!<*Whcb>F*36RSCuk63HX@zy>KRk}d)dLvA;Y2pIGHt;U_^?7`{OOqlc;8_hMF zmL1E7Kn-$)Yjg*XW1+$9B4hrh*QA>*>Uk%=&%6fnHb0+9&P_{BB#aTVPqXb+h|KAo zX&@@K!?a!y4PPcg=Zs5*#3XSX3J4g<^k%SC1mBdiHyvjdy<%hgjb8U17nNL+|kBg9MFtL&bN))*p zuR2BU&vHdBbp?TSIJ=U-up|cb zwe?k%zZ_uxxK3b9q`HF;=Co6zQOj291%a=)qaVTd!k4NEc}rRrOw0Q-X|ZsOJESs{ z{OVBhW8NBF#3Oq@A>kkPL_(5oqBTg&mDb1S-K`}>3#W+Aqo{PX`N`qv`=S>6vbuw3 zFotAuGeg#^MN}=xSv)zlSQ*T(-*bSjsW&?Hotw3H89V1%3fX7u#4?cv?b=k5>`sW0 z*;l02V&*NIV)5PWd{<4!)p}+nm#vfZFNt`9?Zo0NXTvFDrMB1UO~=&QBtHWP=H|qD wE|rt_obYd5Se|okNFHUTn>VK1l&mzTZ#!OI%e;tjWpU#F4Od^fM(!H`0Aku5!~g&Q From 290374300eba0974142053d2dd81cb2ae19cded8 Mon Sep 17 00:00:00 2001 From: Parker Brown <17183625+parkerbxyz@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:17:19 -0800 Subject: [PATCH 5/5] Apply suggestions from code review --- README.md | 4 ++-- action.yml | 4 ++-- tests/main-token-get-owner-set-to-user-fail-response.test.js | 2 +- tests/main-token-get-owner-set-to-user-repo-unset.test.js | 2 +- tests/main-token-get-owner-unset-repo-unset.test.js | 2 +- tests/main.js | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 57bb820..2790c6d 100644 --- a/README.md +++ b/README.md @@ -241,11 +241,11 @@ GitHub App installation access token. ### `installation-id` -GitHub App's installation Id. +GitHub App installation ID. ### `app-slug` -GitHub App's slug. +GitHub App slug. ## How it works diff --git a/action.yml b/action.yml index f5b7cb7..1d2909e 100644 --- a/action.yml +++ b/action.yml @@ -41,9 +41,9 @@ outputs: token: description: "GitHub installation access token" installation-id: - description: "GitHub App's installation Id" + description: "GitHub App installation ID" app-slug: - description: "GitHub App's slug" + description: "GitHub App slug" runs: using: "node20" main: "dist/main.cjs" diff --git a/tests/main-token-get-owner-set-to-user-fail-response.test.js b/tests/main-token-get-owner-set-to-user-fail-response.test.js index 663b32f..318b8dc 100644 --- a/tests/main-token-get-owner-set-to-user-fail-response.test.js +++ b/tests/main-token-get-owner-set-to-user-fail-response.test.js @@ -5,7 +5,7 @@ await test((mockPool) => { process.env.INPUT_OWNER = "smockle"; delete process.env.INPUT_REPOSITORIES; - // Mock installation id and app slug request + // Mock installation ID and app slug request const mockInstallationId = "123456"; const mockAppSlug = "github-actions"; mockPool diff --git a/tests/main-token-get-owner-set-to-user-repo-unset.test.js b/tests/main-token-get-owner-set-to-user-repo-unset.test.js index 6ea0265..a73c3d7 100644 --- a/tests/main-token-get-owner-set-to-user-repo-unset.test.js +++ b/tests/main-token-get-owner-set-to-user-repo-unset.test.js @@ -5,7 +5,7 @@ await test((mockPool) => { process.env.INPUT_OWNER = "smockle"; delete process.env.INPUT_REPOSITORIES; - // Mock installation id and app slug request + // Mock installation ID and app slug request const mockInstallationId = "123456"; const mockAppSlug = "github-actions"; mockPool diff --git a/tests/main-token-get-owner-unset-repo-unset.test.js b/tests/main-token-get-owner-unset-repo-unset.test.js index 7e9217a..e284aae 100644 --- a/tests/main-token-get-owner-unset-repo-unset.test.js +++ b/tests/main-token-get-owner-unset-repo-unset.test.js @@ -5,7 +5,7 @@ await test((mockPool) => { delete process.env.INPUT_OWNER; delete process.env.INPUT_REPOSITORIES; - // Mock installation id and app slug request + // Mock installation ID and app slug request const mockInstallationId = "123456"; const mockAppSlug = "github-actions"; mockPool diff --git a/tests/main.js b/tests/main.js index d8e6985..3e52f69 100644 --- a/tests/main.js +++ b/tests/main.js @@ -54,7 +54,7 @@ export async function test(cb = (_mockPool) => {}, env = DEFAULT_ENV) { // Calling `auth({ type: "app" })` to obtain a JWT doesn’t make network requests, so no need to intercept. - // Mock installation id and app slug request + // Mock installation ID and app slug request const mockInstallationId = "123456"; const mockAppSlug = "github-actions"; const owner = env.INPUT_OWNER ?? env.GITHUB_REPOSITORY_OWNER;