diff --git a/index.js b/index.js
index 24a2664..c459ad7 100644
--- a/index.js
+++ b/index.js
@@ -22128,6 +22128,21 @@ try {
state: "success"
});
};
+ const createJobSummary = async ({
+ project,
+ deployment,
+ aliasUrl
+ }) => {
+ console.log(deployment.stages);
+ await import_core.summary.addHeading(
+ 'Deploying with
Cloudflare Pages'
+ ).addTable([
+ ["**Last commit:**", `\`${deployment.deployment_trigger.metadata.commit_hash.substring(0, 8)}\``],
+ ["**Status:**", ""],
+ ["**Preview URL**:", deployment.url],
+ ["**Branch Preview URL**:", aliasUrl]
+ ]).addLink("Preview URL", deployment.url).write();
+ };
(async () => {
const project = await getProject();
if (!project)
diff --git a/src/index.ts b/src/index.ts
index 0fd82e4..5ec9edf 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,4 +1,4 @@
-import { getInput, setOutput, setFailed } from "@actions/core";
+import { getInput, setOutput, setFailed, summary } from "@actions/core";
import type { Project, Deployment } from '@cloudflare/types';
import { context, getOctokit } from "@actions/github";
import shellac from "shellac";
@@ -92,6 +92,34 @@ try {
});
};
+ const createJobSummary = async (
+ {
+ project,
+ deployment,
+ aliasUrl,
+ }:
+ {
+ project: Project;
+ deployment: Deployment;
+ aliasUrl: string;
+ }
+ ) => {
+ console.log(deployment.stages);
+
+ await summary
+ .addHeading(
+ 'Deploying with
Cloudflare Pages'
+ )
+ .addTable([
+ ['**Last commit:**', `\`${deployment.deployment_trigger.metadata.commit_hash.substring(0, 8)}\``],
+ ['**Status:**', ''],
+ ['**Preview URL**:', deployment.url],
+ ['**Branch Preview URL**:', aliasUrl],
+ ])
+ .addLink('Preview URL', deployment.url)
+ .write();
+ }
+
(async () => {
const project = await getProject();
if (!project) throw new Error('Unable to find pages project')
@@ -106,7 +134,7 @@ try {
const octokit = getOctokit(gitHubToken);
gitHubDeployment = await createGitHubDeployment(octokit, productionEnvironment, environmentName);
}
-
+
const pagesDeployment = await createPagesDeployment();
setOutput("id", pagesDeployment.id);
setOutput("url", pagesDeployment.url);