|
|
@ -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({
|
|
|
|