mirror of
https://github.com/cloudflare/pages-action
synced 2024-11-23 19:36:42 +00:00
Do not create octokit if no github token (#42)
Fixes https://github.com/cloudflare/pages-action/issues/41
This commit is contained in:
parent
ce39707424
commit
226d2ba38e
3
index.js
3
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;
|
||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue