diff --git a/index.js b/index.js index 844ffba..e15008d 100644 --- a/index.js +++ b/index.js @@ -22067,7 +22067,7 @@ try { const directory = (0, import_core.getInput)("directory", { required: true }); const gitHubToken = (0, import_core.getInput)("gitHubToken", { required: false }); const branch = (0, import_core.getInput)("branch", { required: false }); - const octokit = (0, import_github.getOctokit)(gitHubToken); + let octokit; const getProject = async () => { const response = await (0, import_undici.fetch)( `https://api.cloudflare.com/client/v4/accounts/${accountId}/pages/projects/${projectName}`, @@ -22133,6 +22133,7 @@ try { return; } const project = await getProject(); + octokit = (0, import_github.getOctokit)(gitHubToken); const githubBranch = import_process.env.GITHUB_REF_NAME; const productionEnvironment = githubBranch === project.production_branch; let environmentName; diff --git a/package-lock.json b/package-lock.json index 7f2c6ea..1f25408 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pages-action", - "version": "1.0.0", + "version": "1.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pages-action", - "version": "1.0.0", + "version": "1.2.0", "license": "MIT", "dependencies": { "@actions/core": "^1.10.0", diff --git a/src/index.ts b/src/index.ts index f4fd01f..49c5300 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,7 +13,7 @@ try { const gitHubToken = getInput("gitHubToken", { required: false }); const branch = getInput("branch", { required: false }); - const octokit = getOctokit(gitHubToken); + let octokit; const getProject = async () => { const response = await fetch( @@ -96,6 +96,7 @@ try { } const project = await getProject(); + octokit = getOctokit(gitHubToken); const githubBranch = env.GITHUB_REF_NAME; const productionEnvironment = githubBranch === project.production_branch;