Skip to content

Commit f61b6cf

Browse files
authored
Merge pull request #957 from marocchino/remove-base-url
⏪️ Rollback base_url option
2 parents 1926ccb + 4aa1c6a commit f61b6cf

File tree

6 files changed

+4
-45
lines changed

6 files changed

+4
-45
lines changed

__tests__/config.test.ts

-34
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
beforeEach(() => {
22
process.env["GITHUB_REPOSITORY"] = "marocchino/stick-pull-request-comment"
3-
process.env["INPUT_BASE_URL"] = "https://api.github.com"
43
process.env["INPUT_NUMBER"] = "123"
54
process.env["INPUT_APPEND"] = "false"
65
process.env["INPUT_RECREATE"] = "false"
@@ -19,7 +18,6 @@ beforeEach(() => {
1918
afterEach(() => {
2019
jest.resetModules()
2120
delete process.env["GITHUB_REPOSITORY"]
22-
delete process.env["INPUT_BASE_URL"]
2321
delete process.env["INPUT_OWNER"]
2422
delete process.env["INPUT_REPO"]
2523
delete process.env["INPUT_HEADER"]
@@ -40,29 +38,10 @@ afterEach(() => {
4038
delete process.env["INPUT_FOLLOW_SYMBOLIC_LINKS"]
4139
})
4240

43-
test("baseUrl", async () => {
44-
process.env["INPUT_BASE_URL"] = "https://repo.yourcompany.com"
45-
expect(require("../src/config")).toMatchObject({
46-
baseUrl: "https://repo.yourcompany.com",
47-
pullRequestNumber: expect.any(Number),
48-
repo: {owner: "marocchino", repo: "stick-pull-request-comment"},
49-
header: "",
50-
append: false,
51-
recreate: false,
52-
deleteOldComment: false,
53-
hideOldComment: false,
54-
hideAndRecreate: false,
55-
hideClassify: "OUTDATED",
56-
hideDetails: false,
57-
githubToken: "some-token",
58-
ignoreEmpty: false
59-
})
60-
})
6141
test("repo", async () => {
6242
process.env["INPUT_OWNER"] = "jin"
6343
process.env["INPUT_REPO"] = "other"
6444
expect(require("../src/config")).toMatchObject({
65-
baseUrl: "https://api.github.com",
6645
pullRequestNumber: expect.any(Number),
6746
repo: {owner: "jin", repo: "other"},
6847
header: "",
@@ -81,7 +60,6 @@ test("repo", async () => {
8160
test("header", async () => {
8261
process.env["INPUT_HEADER"] = "header"
8362
expect(require("../src/config")).toMatchObject({
84-
baseUrl: "https://api.github.com",
8563
pullRequestNumber: expect.any(Number),
8664
repo: {owner: "marocchino", repo: "stick-pull-request-comment"},
8765
header: "header",
@@ -100,7 +78,6 @@ test("header", async () => {
10078
test("append", async () => {
10179
process.env["INPUT_APPEND"] = "true"
10280
expect(require("../src/config")).toMatchObject({
103-
baseUrl: "https://api.github.com",
10481
pullRequestNumber: expect.any(Number),
10582
repo: {owner: "marocchino", repo: "stick-pull-request-comment"},
10683
header: "",
@@ -119,7 +96,6 @@ test("append", async () => {
11996
test("recreate", async () => {
12097
process.env["INPUT_RECREATE"] = "true"
12198
expect(require("../src/config")).toMatchObject({
122-
baseUrl: "https://api.github.com",
12399
pullRequestNumber: expect.any(Number),
124100
repo: {owner: "marocchino", repo: "stick-pull-request-comment"},
125101
header: "",
@@ -138,7 +114,6 @@ test("recreate", async () => {
138114
test("delete", async () => {
139115
process.env["INPUT_DELETE"] = "true"
140116
expect(require("../src/config")).toMatchObject({
141-
baseUrl: "https://api.github.com",
142117
pullRequestNumber: expect.any(Number),
143118
repo: {owner: "marocchino", repo: "stick-pull-request-comment"},
144119
header: "",
@@ -157,7 +132,6 @@ test("delete", async () => {
157132
test("hideOldComment", async () => {
158133
process.env["INPUT_HIDE"] = "true"
159134
expect(require("../src/config")).toMatchObject({
160-
baseUrl: "https://api.github.com",
161135
pullRequestNumber: expect.any(Number),
162136
repo: {owner: "marocchino", repo: "stick-pull-request-comment"},
163137
header: "",
@@ -176,7 +150,6 @@ test("hideOldComment", async () => {
176150
test("hideAndRecreate", async () => {
177151
process.env["INPUT_HIDE_AND_RECREATE"] = "true"
178152
expect(require("../src/config")).toMatchObject({
179-
baseUrl: "https://api.github.com",
180153
pullRequestNumber: expect.any(Number),
181154
repo: {owner: "marocchino", repo: "stick-pull-request-comment"},
182155
header: "",
@@ -195,7 +168,6 @@ test("hideAndRecreate", async () => {
195168
test("hideClassify", async () => {
196169
process.env["INPUT_HIDE_CLASSIFY"] = "OFF_TOPIC"
197170
expect(require("../src/config")).toMatchObject({
198-
baseUrl: "https://api.github.com",
199171
pullRequestNumber: expect.any(Number),
200172
repo: {owner: "marocchino", repo: "stick-pull-request-comment"},
201173
header: "",
@@ -214,7 +186,6 @@ test("hideClassify", async () => {
214186
test("hideDetails", async () => {
215187
process.env["INPUT_HIDE_DETAILS"] = "true"
216188
expect(require("../src/config")).toMatchObject({
217-
baseUrl: "https://api.github.com",
218189
pullRequestNumber: expect.any(Number),
219190
repo: {owner: "marocchino", repo: "stick-pull-request-comment"},
220191
header: "",
@@ -234,7 +205,6 @@ describe("path", () => {
234205
test("when exists return content of a file", async () => {
235206
process.env["INPUT_PATH"] = "./__tests__/assets/result"
236207
expect(require("../src/config")).toMatchObject({
237-
baseUrl: "https://api.github.com",
238208
pullRequestNumber: expect.any(Number),
239209
repo: {owner: "marocchino", repo: "stick-pull-request-comment"},
240210
header: "",
@@ -254,7 +224,6 @@ describe("path", () => {
254224
test("glob match files", async () => {
255225
process.env["INPUT_PATH"] = "./__tests__/assets/*"
256226
expect(require("../src/config")).toMatchObject({
257-
baseUrl: "https://api.github.com",
258227
pullRequestNumber: expect.any(Number),
259228
repo: {owner: "marocchino", repo: "stick-pull-request-comment"},
260229
header: "",
@@ -276,7 +245,6 @@ describe("path", () => {
276245
test("when not exists return null string", async () => {
277246
process.env["INPUT_PATH"] = "./__tests__/assets/not_exists"
278247
expect(require("../src/config")).toMatchObject({
279-
baseUrl: "https://api.github.com",
280248
pullRequestNumber: expect.any(Number),
281249
repo: {owner: "marocchino", repo: "stick-pull-request-comment"},
282250
header: "",
@@ -297,7 +265,6 @@ describe("path", () => {
297265
test("message", async () => {
298266
process.env["INPUT_MESSAGE"] = "hello there"
299267
expect(require("../src/config")).toMatchObject({
300-
baseUrl: "https://api.github.com",
301268
pullRequestNumber: expect.any(Number),
302269
repo: {owner: "marocchino", repo: "stick-pull-request-comment"},
303270
header: "",
@@ -317,7 +284,6 @@ test("message", async () => {
317284
test("ignore_empty", async () => {
318285
process.env["INPUT_IGNORE_EMPTY"] = "true"
319286
expect(require("../src/config")).toMatchObject({
320-
baseUrl: "https://api.github.com",
321287
pullRequestNumber: expect.any(Number),
322288
repo: {owner: "marocchino", repo: "stick-pull-request-comment"},
323289
header: "",

action.yml

-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ github-token:
1111
pull-requests-reason: to create or update PR comment
1212

1313
inputs:
14-
base_url:
15-
description: "base api url. default to: ${{ env.GITHUB_API_URL }}"
16-
default: "${{ env.GITHUB_API_URL }}"
17-
required: false
1814
header:
1915
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."
2016
default: ""

dist/index.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config.ts

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export const pullRequestNumber =
88
context?.payload?.pull_request?.number ||
99
+core.getInput("number", {required: false})
1010

11-
export const baseUrl = core.getInput("base_url", {required: true})
1211
export const repo = buildRepo()
1312
export const header = core.getInput("header", {required: false})
1413
export const append = core.getBooleanInput("append", {required: true})

src/main.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as github from "@actions/github"
33
import {
44
append,
55
getBody,
6-
baseUrl,
76
deleteOldComment,
87
githubToken,
98
header,
@@ -57,7 +56,7 @@ async function run(): Promise<undefined> {
5756
throw new Error("hide and hide_and_recreate cannot be both set to true")
5857
}
5958

60-
const octokit = github.getOctokit(githubToken, {baseUrl})
59+
const octokit = github.getOctokit(githubToken)
6160
const previous = await findPreviousComment(
6261
octokit,
6362
repo,

0 commit comments

Comments
 (0)