From 04469d4f0722a76ab2031fe86f4ae1667d0860b6 Mon Sep 17 00:00:00 2001 From: Masahiro Furudate <178inaba.git@gmail.com> Date: Sun, 25 Feb 2024 17:48:38 +0900 Subject: [PATCH 1/2] Remove `createCheck` --- src/createCheck.ts | 40 ---------------------------------------- src/index.ts | 34 ---------------------------------- 2 files changed, 74 deletions(-) delete mode 100644 src/createCheck.ts diff --git a/src/createCheck.ts b/src/createCheck.ts deleted file mode 100644 index f445e2fc..00000000 --- a/src/createCheck.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import type { Context } from "@actions/github/lib/context"; -import type { GitHub } from "@actions/github/lib/utils"; - -// create a check and return a function that updates (completes) it -export async function createCheck( - github: InstanceType, - context: Context -) { - const check = await github.rest.checks.create({ - ...context.repo, - name: "Deploy Preview", - head_sha: context.payload.pull_request?.head.sha, - status: "in_progress", - }); - - return async (details: Object) => { - await github.rest.checks.update({ - ...context.repo, - check_run_id: check.data.id, - completed_at: new Date().toISOString(), - status: "completed", - ...details, - }); - }; -} diff --git a/src/index.ts b/src/index.ts index fe34502b..826a2d21 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,7 +23,6 @@ import { } from "@actions/core"; import { context, getOctokit } from "@actions/github"; import { existsSync } from "fs"; -import { createCheck } from "./createCheck"; import { createGacFile } from "./createGACFile"; import { deployPreview, @@ -55,11 +54,6 @@ const disableComment = getInput("disableComment"); async function run() { const isPullRequest = !!context.payload.pull_request; - let finish = (details: Object) => console.log(details); - if (token && isPullRequest) { - finish = await createCheck(octokit, context); - } - try { startGroup("Verifying firebase.json exists"); @@ -99,17 +93,6 @@ async function run() { throw Error((deployment as ErrorResult).error); } endGroup(); - - const hostname = target ? `${target}.web.app` : `${projectId}.web.app`; - const url = `https://${hostname}/`; - await finish({ - details_url: url, - conclusion: "success", - output: { - title: `Production deploy succeeded`, - summary: `[${hostname}](${url})`, - }, - }); return; } @@ -146,25 +129,8 @@ async function run() { await postChannelSuccessComment(octokit, context, deployment, commitId); } - - await finish({ - details_url: urls[0], - conclusion: "success", - output: { - title: `Deploy preview succeeded`, - summary: getURLsMarkdownFromChannelDeployResult(deployment), - }, - }); } catch (e) { setFailed(e.message); - - await finish({ - conclusion: "failure", - output: { - title: "Deploy preview failed", - summary: `Error: ${e.message}`, - }, - }); } } From 94468b775eabe04e7a48171e949b8729d046849f Mon Sep 17 00:00:00 2001 From: Masahiro Furudate <178inaba.git@gmail.com> Date: Wed, 2 Oct 2024 01:44:02 +0900 Subject: [PATCH 2/2] Run `npm run build` --- bin/action.min.js | 50 ----------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/bin/action.min.js b/bin/action.min.js index 8324beb8..280cbb89 100644 --- a/bin/action.min.js +++ b/bin/action.min.js @@ -87331,26 +87331,6 @@ exports.getOctokit = getOctokit; }); -// create a check and return a function that updates (completes) it -async function createCheck(github, context) { - var _context$payload$pull; - const check = await github.rest.checks.create({ - ...context.repo, - name: "Deploy Preview", - head_sha: (_context$payload$pull = context.payload.pull_request) == null ? void 0 : _context$payload$pull.head.sha, - status: "in_progress" - }); - return async details => { - await github.rest.checks.update({ - ...context.repo, - check_run_id: check.data.id, - completed_at: new Date().toISOString(), - status: "completed", - ...details - }); - }; -} - // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -92976,7 +92956,6 @@ async function execWithCredentials(args, projectId, gacFilename, opts) { } return deployOutputBuf.length ? deployOutputBuf[deployOutputBuf.length - 1].toString("utf-8") : ""; // output from the CLI } - async function deployPreview(gacFilename, deployConfig) { const { projectId, @@ -93184,10 +93163,6 @@ const firebaseToolsVersion = core.getInput("firebaseToolsVersion"); const disableComment = core.getInput("disableComment"); async function run() { const isPullRequest = !!github.context.payload.pull_request; - let finish = details => console.log(details); - if (token && isPullRequest) { - finish = await createCheck(octokit, github.context); - } try { core.startGroup("Verifying firebase.json exists"); if (entryPoint !== ".") { @@ -93219,16 +93194,6 @@ async function run() { throw Error(deployment.error); } core.endGroup(); - const hostname = target ? `${target}.web.app` : `${projectId}.web.app`; - const url = `https://${hostname}/`; - await finish({ - details_url: url, - conclusion: "success", - output: { - title: `Production deploy succeeded`, - summary: `[${hostname}](${url})` - } - }); return; } const channelId = getChannelId(configuredChannelId, github.context); @@ -93260,23 +93225,8 @@ async function run() { const commitId = (_context$payload$pull = github.context.payload.pull_request) == null ? void 0 : _context$payload$pull.head.sha.substring(0, 7); await postChannelSuccessComment(octokit, github.context, deployment, commitId); } - await finish({ - details_url: urls[0], - conclusion: "success", - output: { - title: `Deploy preview succeeded`, - summary: getURLsMarkdownFromChannelDeployResult(deployment) - } - }); } catch (e) { core.setFailed(e.message); - await finish({ - conclusion: "failure", - output: { - title: "Deploy preview failed", - summary: `Error: ${e.message}` - } - }); } } run();