test-token: use auth-only endpoint to actually verify the token
Made-with: Cursor
This commit is contained in:
committed by
pullfrog[bot]
parent
1393ffb7b8
commit
6541bdc4f4
@@ -20,13 +20,14 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
|
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
|
||||||
run: |
|
run: |
|
||||||
node -e '
|
node -e '
|
||||||
const res = await fetch("https://api.github.com/repos/" + process.env.GITHUB_REPOSITORY, {
|
const res = await fetch("https://api.github.com/installation/repositories?per_page=1", {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: "token " + process.env.GITHUB_TOKEN,
|
Authorization: "token " + process.env.GITHUB_TOKEN,
|
||||||
Accept: "application/vnd.github+json",
|
Accept: "application/vnd.github+json",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!res.ok) throw new Error("GET repo failed: " + res.status + " " + (await res.text()));
|
if (!res.ok) throw new Error("GET installation/repositories failed: " + res.status + " " + (await res.text()));
|
||||||
const repo = await res.json();
|
const data = await res.json();
|
||||||
console.log("authenticated as installation — repo:", repo.full_name, "private:", repo.private);
|
console.log("authenticated — installation has access to", data.total_count, "repo(s)");
|
||||||
|
console.log("first repo:", data.repositories[0].full_name);
|
||||||
'
|
'
|
||||||
|
|||||||
+2
-12
@@ -74,24 +74,14 @@
|
|||||||
"url": "https://github.com/pullfrog/pullfrog/issues"
|
"url": "https://github.com/pullfrog/pullfrog/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/pullfrog/pullfrog#readme",
|
"homepage": "https://github.com/pullfrog/pullfrog#readme",
|
||||||
"zshy": {
|
|
||||||
"exports": "./index.ts"
|
|
||||||
},
|
|
||||||
"main": "./dist/index.js",
|
|
||||||
"module": "./dist/index.js",
|
|
||||||
"types": "./dist/index.d.ts",
|
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"@pullfrog/source": "./index.ts",
|
"@pullfrog/source": "./index.ts",
|
||||||
"types": "./dist/index.d.cts",
|
"default": "./index.ts"
|
||||||
"import": "./dist/index.js",
|
|
||||||
"require": "./dist/index.cjs"
|
|
||||||
},
|
},
|
||||||
"./internal": {
|
"./internal": {
|
||||||
"@pullfrog/source": "./internal/index.ts",
|
"@pullfrog/source": "./internal/index.ts",
|
||||||
"types": "./dist/internal.d.cts",
|
"default": "./internal/index.ts"
|
||||||
"import": "./dist/internal.js",
|
|
||||||
"default": "./dist/internal.js"
|
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user