pull/33/head
Daniel Walsh 3 years ago
parent 7430fe507a
commit c74fab918c
No known key found for this signature in database
GPG Key ID: 2533E346A14D232D

@ -22123,13 +22123,18 @@ try {
} }
const gitHubDeployment = await createGitHubDeployment(); const gitHubDeployment = await createGitHubDeployment();
const pagesDeployment = await createPagesDeployment(); const pagesDeployment = await createPagesDeployment();
console.log(pagesDeployment); const productionEnvironment = pagesDeployment.environment === "production";
(0, import_core.setOutput)("id", pagesDeployment.id); (0, import_core.setOutput)("id", pagesDeployment.id);
(0, import_core.setOutput)("url", pagesDeployment.url); (0, import_core.setOutput)("url", pagesDeployment.url);
(0, import_core.setOutput)("environment", pagesDeployment.environment); (0, import_core.setOutput)("environment", pagesDeployment.environment);
(0, import_core.setOutput)("alias", pagesDeployment.environment === "production" ? pagesDeployment.url : pagesDeployment.aliases[0]); (0, import_core.setOutput)("alias", productionEnvironment ? pagesDeployment.url : pagesDeployment.aliases[0]);
const productionEnvironment = pagesDeployment.environment === "production"; let environmentName;
const environmentName = productionEnvironment ? "Production" : `Preview (${pagesDeployment.aliases[0]})`; if (productionEnvironment) {
environmentName = "Production";
} else {
const url = new URL(pagesDeployment.aliases[0]);
environmentName = `Preview (${url.hostname.split(".")[0]})`;
}
if (gitHubDeployment) { if (gitHubDeployment) {
await createGitHubDeploymentStatus({ await createGitHubDeploymentStatus({
id: gitHubDeployment.id, id: gitHubDeployment.id,

@ -2,7 +2,7 @@ import { getInput, setOutput, setFailed } from "@actions/core";
import { context, getOctokit } from "@actions/github"; import { context, getOctokit } from "@actions/github";
import shellac from "shellac"; import shellac from "shellac";
import { fetch } from "undici"; import { fetch } from "undici";
import { Deployment } from '@cloudflare/types'; import type { Deployment } from '@cloudflare/types';
try { try {
const apiToken = getInput("apiToken", { required: true }); const apiToken = getInput("apiToken", { required: true });
@ -87,19 +87,21 @@ try {
const pagesDeployment = await createPagesDeployment(); const pagesDeployment = await createPagesDeployment();
// wut const productionEnvironment = pagesDeployment.environment === "production";
console.log(pagesDeployment);
setOutput("id", pagesDeployment.id); setOutput("id", pagesDeployment.id);
setOutput("url", pagesDeployment.url); setOutput("url", pagesDeployment.url);
setOutput("environment", pagesDeployment.environment); setOutput("environment", pagesDeployment.environment);
setOutput("alias", pagesDeployment.environment === "production" ? pagesDeployment.url : pagesDeployment.aliases[0]); setOutput("alias", productionEnvironment ? pagesDeployment.url : pagesDeployment.aliases[0]);
const productionEnvironment = pagesDeployment.environment === "production"; let environmentName: string;
const environmentName = productionEnvironment if (productionEnvironment) {
? "Production" environmentName = "Production"
} else {
const url = new URL(pagesDeployment.aliases[0]);
// Use the branch alias (staging/walshy-fix-bug) // Use the branch alias (staging/walshy-fix-bug)
: `Preview (${pagesDeployment.aliases[0]})`; environmentName = `Preview (${url.hostname.split(".")[0]})`;
}
if (gitHubDeployment) { if (gitHubDeployment) {
await createGitHubDeploymentStatus({ await createGitHubDeploymentStatus({

Loading…
Cancel
Save