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 }}
|
||||
run: |
|
||||
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: {
|
||||
Authorization: "token " + process.env.GITHUB_TOKEN,
|
||||
Accept: "application/vnd.github+json",
|
||||
},
|
||||
});
|
||||
if (!res.ok) throw new Error("GET repo failed: " + res.status + " " + (await res.text()));
|
||||
const repo = await res.json();
|
||||
console.log("authenticated as installation — repo:", repo.full_name, "private:", repo.private);
|
||||
if (!res.ok) throw new Error("GET installation/repositories failed: " + res.status + " " + (await res.text()));
|
||||
const data = await res.json();
|
||||
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"
|
||||
},
|
||||
"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": {
|
||||
".": {
|
||||
"@pullfrog/source": "./index.ts",
|
||||
"types": "./dist/index.d.cts",
|
||||
"import": "./dist/index.js",
|
||||
"require": "./dist/index.cjs"
|
||||
"default": "./index.ts"
|
||||
},
|
||||
"./internal": {
|
||||
"@pullfrog/source": "./internal/index.ts",
|
||||
"types": "./dist/internal.d.cts",
|
||||
"import": "./dist/internal.js",
|
||||
"default": "./dist/internal.js"
|
||||
"default": "./internal/index.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user