test: add coverage (#58)
This commit is contained in:
+2
-1
@@ -1,2 +1,3 @@
|
|||||||
node_modules/
|
|
||||||
.env
|
.env
|
||||||
|
coverage
|
||||||
|
node_modules/
|
||||||
|
|||||||
+2
-1
@@ -100,6 +100,7 @@ export async function main(
|
|||||||
authorization: `bearer ${appAuthentication.token}`,
|
authorization: `bearer ${appAuthentication.token}`,
|
||||||
},
|
},
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
|
/* c8 ignore next */
|
||||||
if (error.status !== 404) throw error;
|
if (error.status !== 404) throw error;
|
||||||
|
|
||||||
// https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-a-user-installation-for-the-authenticated-app
|
// https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-a-user-installation-for-the-authenticated-app
|
||||||
@@ -122,7 +123,7 @@ export async function main(
|
|||||||
core.setSecret(authentication.token);
|
core.setSecret(authentication.token);
|
||||||
|
|
||||||
core.setOutput("token", authentication.token);
|
core.setOutput("token", authentication.token);
|
||||||
|
|
||||||
// Make token accessible to post function (so we can invalidate it)
|
// Make token accessible to post function (so we can invalidate it)
|
||||||
if (!skipTokenRevoke) {
|
if (!skipTokenRevoke) {
|
||||||
core.saveState("token", authentication.token);
|
core.saveState("token", authentication.token);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ main(
|
|||||||
}),
|
}),
|
||||||
skipTokenRevoke
|
skipTokenRevoke
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
|
/* c8 ignore next 3 */
|
||||||
console.error(error);
|
console.error(error);
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
});
|
});
|
||||||
|
|||||||
Generated
+1673
-2
File diff suppressed because it is too large
Load Diff
+5
-1
@@ -6,7 +6,9 @@
|
|||||||
"description": "GitHub Action for creating a GitHub App Installation Access Token",
|
"description": "GitHub Action for creating a GitHub App Installation Access Token",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "esbuild main.js post.js --bundle --outdir=dist --out-extension:.js=.cjs --platform=node --target=node16.16",
|
"build": "esbuild main.js post.js --bundle --outdir=dist --out-extension:.js=.cjs --platform=node --target=node16.16",
|
||||||
"test": "ava tests/index.js"
|
"test": "c8 --100 ava tests/index.js",
|
||||||
|
"coverage": "c8 report --reporter html",
|
||||||
|
"postcoverage": "open-cli coverage/index.html"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -16,9 +18,11 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ava": "^5.3.1",
|
"ava": "^5.3.1",
|
||||||
|
"c8": "^8.0.1",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.3.1",
|
||||||
"esbuild": "^0.19.4",
|
"esbuild": "^0.19.4",
|
||||||
"execa": "^8.0.1",
|
"execa": "^8.0.1",
|
||||||
|
"open-cli": "^7.2.0",
|
||||||
"undici": "^5.25.2"
|
"undici": "^5.25.2"
|
||||||
},
|
},
|
||||||
"release": {
|
"release": {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ post(
|
|||||||
baseUrl: process.env["GITHUB_API_URL"],
|
baseUrl: process.env["GITHUB_API_URL"],
|
||||||
})
|
})
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
|
/* c8 ignore next 3 */
|
||||||
console.error(error);
|
console.error(error);
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user