Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5393d3dab4 | |||
| 3c2f3722ff | |||
| 6541bdc4f4 | |||
| 1393ffb7b8 | |||
| f663d5e34d | |||
| d1e075fa3b | |||
| ed90735ba0 |
@@ -101,7 +101,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Publish to npm
|
- name: Publish to npm
|
||||||
if: steps.check_tag.outputs.exists == 'false'
|
if: steps.check_tag.outputs.exists == 'false'
|
||||||
run: NODE_AUTH_TOKEN="" npm publish --provenance --access public
|
run: npm publish --provenance --access public
|
||||||
|
|
||||||
- name: Summary
|
- name: Summary
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
name: Test get-installation-token
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-token:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Get installation token
|
||||||
|
id: token
|
||||||
|
uses: pullfrog/pullfrog/get-installation-token@main
|
||||||
|
|
||||||
|
- name: Verify token with Node.js
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
|
||||||
|
run: |
|
||||||
|
node -e '
|
||||||
|
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 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);
|
||||||
|
'
|
||||||
+19
-1
@@ -1,10 +1,13 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
import { build } from "esbuild";
|
import { build } from "esbuild";
|
||||||
import { readFileSync, writeFileSync } from "fs";
|
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
||||||
|
|
||||||
const pkg = JSON.parse(readFileSync("package.json", "utf-8"));
|
const pkg = JSON.parse(readFileSync("package.json", "utf-8"));
|
||||||
|
|
||||||
|
rmSync("./dist", { recursive: true, force: true });
|
||||||
|
mkdirSync("./dist", { recursive: true });
|
||||||
|
|
||||||
// Plugin to strip shebangs from output files
|
// Plugin to strip shebangs from output files
|
||||||
/**
|
/**
|
||||||
* @type {import("esbuild").Plugin}
|
* @type {import("esbuild").Plugin}
|
||||||
@@ -73,6 +76,21 @@ await build({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Build ESM library entrypoints for programmatic imports
|
||||||
|
await build({
|
||||||
|
...sharedConfig,
|
||||||
|
entryPoints: ["./index.ts"],
|
||||||
|
outfile: "./dist/index.js",
|
||||||
|
target: "node20",
|
||||||
|
});
|
||||||
|
|
||||||
|
await build({
|
||||||
|
...sharedConfig,
|
||||||
|
entryPoints: ["./internal/index.ts"],
|
||||||
|
outfile: "./dist/internal.js",
|
||||||
|
target: "node20",
|
||||||
|
});
|
||||||
|
|
||||||
// prepend shebang after strip (esbuild banner can't guarantee line 1 placement)
|
// prepend shebang after strip (esbuild banner can't guarantee line 1 placement)
|
||||||
const cliPath = "./dist/cli.mjs";
|
const cliPath = "./dist/cli.mjs";
|
||||||
const cliContent = readFileSync(cliPath, "utf8");
|
const cliContent = readFileSync(cliPath, "utf8");
|
||||||
|
|||||||
+5
-8
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pullfrog",
|
"name": "pullfrog",
|
||||||
"version": "0.0.196",
|
"version": "0.0.198",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
"pullfrog": "dist/cli.mjs",
|
"pullfrog": "dist/cli.mjs",
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"build": "node esbuild.config.js",
|
"build": "node esbuild.config.js && tsc -p tsconfig.exports.json",
|
||||||
"check:entrypoints": "node scripts/check-entrypoint-imports.ts",
|
"check:entrypoints": "node scripts/check-entrypoint-imports.ts",
|
||||||
"play": "node play.ts",
|
"play": "node play.ts",
|
||||||
"runtest": "node test/run.ts",
|
"runtest": "node test/run.ts",
|
||||||
@@ -74,22 +74,19 @@
|
|||||||
"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",
|
"main": "./dist/index.js",
|
||||||
"module": "./dist/index.js",
|
"module": "./dist/index.js",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"@pullfrog/source": "./index.ts",
|
"@pullfrog/source": "./index.ts",
|
||||||
"types": "./dist/index.d.cts",
|
"types": "./dist/index.d.ts",
|
||||||
"import": "./dist/index.js",
|
"import": "./dist/index.js",
|
||||||
"require": "./dist/index.cjs"
|
"default": "./dist/index.js"
|
||||||
},
|
},
|
||||||
"./internal": {
|
"./internal": {
|
||||||
"@pullfrog/source": "./internal/index.ts",
|
"@pullfrog/source": "./internal/index.ts",
|
||||||
"types": "./dist/internal.d.cts",
|
"types": "./dist/internal/index.d.ts",
|
||||||
"import": "./dist/internal.js",
|
"import": "./dist/internal.js",
|
||||||
"default": "./dist/internal.js"
|
"default": "./dist/internal.js"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ function runNpx(context: RuntimeContext, packageSpec: string, cliArgs: string[])
|
|||||||
? join(context.nodeBinDir, "npx.cmd")
|
? join(context.nodeBinDir, "npx.cmd")
|
||||||
: join(context.nodeBinDir, "npx");
|
: join(context.nodeBinDir, "npx");
|
||||||
execFileSync(npxPath, ["--yes", packageSpec, ...cliArgs], {
|
execFileSync(npxPath, ["--yes", packageSpec, ...cliArgs], {
|
||||||
cwd: context.actionRoot,
|
cwd: process.env.GITHUB_WORKSPACE || context.actionRoot,
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
env: context.env,
|
env: context.env,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"noEmit": false,
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"declarationMap": false,
|
||||||
|
"outDir": "./dist"
|
||||||
|
},
|
||||||
|
"include": ["index.ts", "internal/index.ts"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user