Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 401496f19f | |||
| 8822968cbb | |||
| c18db965c3 |
@@ -40481,7 +40481,7 @@ function query({
|
|||||||
// package.json
|
// package.json
|
||||||
var package_default = {
|
var package_default = {
|
||||||
name: "@pullfrog/action",
|
name: "@pullfrog/action",
|
||||||
version: "0.0.91",
|
version: "0.0.94",
|
||||||
type: "module",
|
type: "module",
|
||||||
files: [
|
files: [
|
||||||
"index.js",
|
"index.js",
|
||||||
@@ -40911,6 +40911,9 @@ function checkExistingToken() {
|
|||||||
const envToken = process.env.GITHUB_INSTALLATION_TOKEN;
|
const envToken = process.env.GITHUB_INSTALLATION_TOKEN;
|
||||||
return inputToken || envToken || null;
|
return inputToken || envToken || null;
|
||||||
}
|
}
|
||||||
|
function getGitHubTokenInput() {
|
||||||
|
return core2.getInput("github_token") || null;
|
||||||
|
}
|
||||||
function isGitHubActionsEnvironment() {
|
function isGitHubActionsEnvironment() {
|
||||||
return Boolean(process.env.GITHUB_ACTIONS);
|
return Boolean(process.env.GITHUB_ACTIONS);
|
||||||
}
|
}
|
||||||
@@ -41057,7 +41060,24 @@ async function acquireNewToken() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function getDefaultGitHubToken() {
|
function getDefaultGitHubToken() {
|
||||||
return process.env.GITHUB_TOKEN || null;
|
const inputToken = getGitHubTokenInput();
|
||||||
|
if (inputToken) {
|
||||||
|
return inputToken;
|
||||||
|
}
|
||||||
|
const token = process.env.GITHUB_TOKEN;
|
||||||
|
if (!token && isGitHubActionsEnvironment()) {
|
||||||
|
const githubEnvVars = Object.keys(process.env).filter((key) => key.startsWith("GITHUB_")).reduce(
|
||||||
|
(acc, key) => {
|
||||||
|
acc[key] = key === "GITHUB_TOKEN" ? process.env[key] ? "***SET***" : "NOT_SET" : process.env[key];
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
log.warning(
|
||||||
|
`GITHUB_TOKEN not found. Available GITHUB_* env vars: ${JSON.stringify(githubEnvVars)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return token || null;
|
||||||
}
|
}
|
||||||
async function setupGitHubInstallationToken() {
|
async function setupGitHubInstallationToken() {
|
||||||
const existingToken = checkExistingToken();
|
const existingToken = checkExistingToken();
|
||||||
@@ -41540,6 +41560,10 @@ async function run() {
|
|||||||
log.debug(`New working directory: ${process.cwd()}`);
|
log.debug(`New working directory: ${process.cwd()}`);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
const githubTokenInput = core3.getInput("github_token");
|
||||||
|
if (githubTokenInput) {
|
||||||
|
process.env.GITHUB_TOKEN = githubTokenInput;
|
||||||
|
}
|
||||||
const inputs = {
|
const inputs = {
|
||||||
prompt: core3.getInput("prompt", { required: true }),
|
prompt: core3.getInput("prompt", { required: true }),
|
||||||
anthropic_api_key: core3.getInput("anthropic_api_key") || void 0
|
anthropic_api_key: core3.getInput("anthropic_api_key") || void 0
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ async function run(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Set GITHUB_TOKEN from input if provided (allows fallback to env var)
|
||||||
|
const githubTokenInput = core.getInput("github_token");
|
||||||
|
if (githubTokenInput) {
|
||||||
|
process.env.GITHUB_TOKEN = githubTokenInput;
|
||||||
|
}
|
||||||
|
|
||||||
const inputs: Inputs = {
|
const inputs: Inputs = {
|
||||||
prompt: core.getInput("prompt", { required: true }),
|
prompt: core.getInput("prompt", { required: true }),
|
||||||
anthropic_api_key: core.getInput("anthropic_api_key") || undefined,
|
anthropic_api_key: core.getInput("anthropic_api_key") || undefined,
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pullfrog/action",
|
"name": "@pullfrog/action",
|
||||||
"version": "0.0.91",
|
"version": "0.0.94",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"files": [
|
"files": [
|
||||||
"index.js",
|
"index.js",
|
||||||
|
|||||||
+35
-1
@@ -49,6 +49,10 @@ function checkExistingToken(): string | null {
|
|||||||
return inputToken || envToken || null;
|
return inputToken || envToken || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getGitHubTokenInput(): string | null {
|
||||||
|
return core.getInput("github_token") || null;
|
||||||
|
}
|
||||||
|
|
||||||
function isGitHubActionsEnvironment(): boolean {
|
function isGitHubActionsEnvironment(): boolean {
|
||||||
return Boolean(process.env.GITHUB_ACTIONS);
|
return Boolean(process.env.GITHUB_ACTIONS);
|
||||||
}
|
}
|
||||||
@@ -255,7 +259,37 @@ async function acquireNewToken(): Promise<string | null> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultGitHubToken(): string | null {
|
function getDefaultGitHubToken(): string | null {
|
||||||
return process.env.GITHUB_TOKEN || null;
|
// Try input first (explicitly passed from workflow)
|
||||||
|
const inputToken = getGitHubTokenInput();
|
||||||
|
if (inputToken) {
|
||||||
|
return inputToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then try environment variable (automatically set by GitHub Actions)
|
||||||
|
const token = process.env.GITHUB_TOKEN;
|
||||||
|
|
||||||
|
// Log diagnostic info when GITHUB_TOKEN is missing
|
||||||
|
if (!token && isGitHubActionsEnvironment()) {
|
||||||
|
const githubEnvVars = Object.keys(process.env)
|
||||||
|
.filter((key) => key.startsWith("GITHUB_"))
|
||||||
|
.reduce(
|
||||||
|
(acc, key) => {
|
||||||
|
acc[key] =
|
||||||
|
key === "GITHUB_TOKEN"
|
||||||
|
? process.env[key]
|
||||||
|
? "***SET***"
|
||||||
|
: "NOT_SET"
|
||||||
|
: process.env[key];
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
{} as Record<string, string | undefined>
|
||||||
|
);
|
||||||
|
log.warning(
|
||||||
|
`GITHUB_TOKEN not found. Available GITHUB_* env vars: ${JSON.stringify(githubEnvVars)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return token || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user