From 6be016636ec5051949a8b64e5f032a92a1479583 Mon Sep 17 00:00:00 2001 From: marocchino Date: Fri, 21 Apr 2023 16:20:06 +0900 Subject: [PATCH] =?UTF-8?q?=E2=8F=AA=EF=B8=8F=20Rollback=20base=5Furl=20op?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __tests__/config.test.ts | 34 ---------------------------------- action.yml | 4 ---- src/config.ts | 1 - src/main.ts | 3 +-- 4 files changed, 1 insertion(+), 41 deletions(-) diff --git a/__tests__/config.test.ts b/__tests__/config.test.ts index 262521c..327917c 100644 --- a/__tests__/config.test.ts +++ b/__tests__/config.test.ts @@ -1,6 +1,5 @@ beforeEach(() => { process.env["GITHUB_REPOSITORY"] = "marocchino/stick-pull-request-comment" - process.env["INPUT_BASE_URL"] = "https://api.github.com" process.env["INPUT_NUMBER"] = "123" process.env["INPUT_APPEND"] = "false" process.env["INPUT_RECREATE"] = "false" @@ -19,7 +18,6 @@ beforeEach(() => { afterEach(() => { jest.resetModules() delete process.env["GITHUB_REPOSITORY"] - delete process.env["INPUT_BASE_URL"] delete process.env["INPUT_OWNER"] delete process.env["INPUT_REPO"] delete process.env["INPUT_HEADER"] @@ -40,29 +38,10 @@ afterEach(() => { delete process.env["INPUT_FOLLOW_SYMBOLIC_LINKS"] }) -test("baseUrl", async () => { - process.env["INPUT_BASE_URL"] = "https://repo.yourcompany.com" - expect(require("../src/config")).toMatchObject({ - baseUrl: "https://repo.yourcompany.com", - pullRequestNumber: expect.any(Number), - repo: {owner: "marocchino", repo: "stick-pull-request-comment"}, - header: "", - append: false, - recreate: false, - deleteOldComment: false, - hideOldComment: false, - hideAndRecreate: false, - hideClassify: "OUTDATED", - hideDetails: false, - githubToken: "some-token", - ignoreEmpty: false - }) -}) test("repo", async () => { process.env["INPUT_OWNER"] = "jin" process.env["INPUT_REPO"] = "other" expect(require("../src/config")).toMatchObject({ - baseUrl: "https://api.github.com", pullRequestNumber: expect.any(Number), repo: {owner: "jin", repo: "other"}, header: "", @@ -81,7 +60,6 @@ test("repo", async () => { test("header", async () => { process.env["INPUT_HEADER"] = "header" expect(require("../src/config")).toMatchObject({ - baseUrl: "https://api.github.com", pullRequestNumber: expect.any(Number), repo: {owner: "marocchino", repo: "stick-pull-request-comment"}, header: "header", @@ -100,7 +78,6 @@ test("header", async () => { test("append", async () => { process.env["INPUT_APPEND"] = "true" expect(require("../src/config")).toMatchObject({ - baseUrl: "https://api.github.com", pullRequestNumber: expect.any(Number), repo: {owner: "marocchino", repo: "stick-pull-request-comment"}, header: "", @@ -119,7 +96,6 @@ test("append", async () => { test("recreate", async () => { process.env["INPUT_RECREATE"] = "true" expect(require("../src/config")).toMatchObject({ - baseUrl: "https://api.github.com", pullRequestNumber: expect.any(Number), repo: {owner: "marocchino", repo: "stick-pull-request-comment"}, header: "", @@ -138,7 +114,6 @@ test("recreate", async () => { test("delete", async () => { process.env["INPUT_DELETE"] = "true" expect(require("../src/config")).toMatchObject({ - baseUrl: "https://api.github.com", pullRequestNumber: expect.any(Number), repo: {owner: "marocchino", repo: "stick-pull-request-comment"}, header: "", @@ -157,7 +132,6 @@ test("delete", async () => { test("hideOldComment", async () => { process.env["INPUT_HIDE"] = "true" expect(require("../src/config")).toMatchObject({ - baseUrl: "https://api.github.com", pullRequestNumber: expect.any(Number), repo: {owner: "marocchino", repo: "stick-pull-request-comment"}, header: "", @@ -176,7 +150,6 @@ test("hideOldComment", async () => { test("hideAndRecreate", async () => { process.env["INPUT_HIDE_AND_RECREATE"] = "true" expect(require("../src/config")).toMatchObject({ - baseUrl: "https://api.github.com", pullRequestNumber: expect.any(Number), repo: {owner: "marocchino", repo: "stick-pull-request-comment"}, header: "", @@ -195,7 +168,6 @@ test("hideAndRecreate", async () => { test("hideClassify", async () => { process.env["INPUT_HIDE_CLASSIFY"] = "OFF_TOPIC" expect(require("../src/config")).toMatchObject({ - baseUrl: "https://api.github.com", pullRequestNumber: expect.any(Number), repo: {owner: "marocchino", repo: "stick-pull-request-comment"}, header: "", @@ -214,7 +186,6 @@ test("hideClassify", async () => { test("hideDetails", async () => { process.env["INPUT_HIDE_DETAILS"] = "true" expect(require("../src/config")).toMatchObject({ - baseUrl: "https://api.github.com", pullRequestNumber: expect.any(Number), repo: {owner: "marocchino", repo: "stick-pull-request-comment"}, header: "", @@ -234,7 +205,6 @@ describe("path", () => { test("when exists return content of a file", async () => { process.env["INPUT_PATH"] = "./__tests__/assets/result" expect(require("../src/config")).toMatchObject({ - baseUrl: "https://api.github.com", pullRequestNumber: expect.any(Number), repo: {owner: "marocchino", repo: "stick-pull-request-comment"}, header: "", @@ -254,7 +224,6 @@ describe("path", () => { test("glob match files", async () => { process.env["INPUT_PATH"] = "./__tests__/assets/*" expect(require("../src/config")).toMatchObject({ - baseUrl: "https://api.github.com", pullRequestNumber: expect.any(Number), repo: {owner: "marocchino", repo: "stick-pull-request-comment"}, header: "", @@ -276,7 +245,6 @@ describe("path", () => { test("when not exists return null string", async () => { process.env["INPUT_PATH"] = "./__tests__/assets/not_exists" expect(require("../src/config")).toMatchObject({ - baseUrl: "https://api.github.com", pullRequestNumber: expect.any(Number), repo: {owner: "marocchino", repo: "stick-pull-request-comment"}, header: "", @@ -297,7 +265,6 @@ describe("path", () => { test("message", async () => { process.env["INPUT_MESSAGE"] = "hello there" expect(require("../src/config")).toMatchObject({ - baseUrl: "https://api.github.com", pullRequestNumber: expect.any(Number), repo: {owner: "marocchino", repo: "stick-pull-request-comment"}, header: "", @@ -317,7 +284,6 @@ test("message", async () => { test("ignore_empty", async () => { process.env["INPUT_IGNORE_EMPTY"] = "true" expect(require("../src/config")).toMatchObject({ - baseUrl: "https://api.github.com", pullRequestNumber: expect.any(Number), repo: {owner: "marocchino", repo: "stick-pull-request-comment"}, header: "", diff --git a/action.yml b/action.yml index 184411f..6c9d264 100644 --- a/action.yml +++ b/action.yml @@ -11,10 +11,6 @@ github-token: pull-requests-reason: to create or update PR comment inputs: - base_url: - description: "base api url. default to: ${{ env.GITHUB_API_URL }}" - default: "${{ env.GITHUB_API_URL }}" - required: false header: description: "Header to determine if the comment is to be updated, not shown on screen. It can be used when you want to add multiple comments independently at the same time." default: "" diff --git a/src/config.ts b/src/config.ts index 7db26a2..13ee0de 100644 --- a/src/config.ts +++ b/src/config.ts @@ -8,7 +8,6 @@ export const pullRequestNumber = context?.payload?.pull_request?.number || +core.getInput("number", {required: false}) -export const baseUrl = core.getInput("base_url", {required: true}) export const repo = buildRepo() export const header = core.getInput("header", {required: false}) export const append = core.getBooleanInput("append", {required: true}) diff --git a/src/main.ts b/src/main.ts index e580192..3232fce 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,7 +3,6 @@ import * as github from "@actions/github" import { append, getBody, - baseUrl, deleteOldComment, githubToken, header, @@ -57,7 +56,7 @@ async function run(): Promise { throw new Error("hide and hide_and_recreate cannot be both set to true") } - const octokit = github.getOctokit(githubToken, {baseUrl}) + const octokit = github.getOctokit(githubToken) const previous = await findPreviousComment( octokit, repo,