Skip to content

Commit 8361e49

Browse files
jakubikanJakub Wernerpascalgn
authored
Using GITHUB_SERVER_URL for baseUrl (#238)
* Using GITHUB_SERVER_URL * eslint fix * adding this also to automerge function * Undo unrelated changes --------- Co-authored-by: Jakub Werner <jakub.werner@bmw.de> Co-authored-by: Pascal <pascal.gruen@gmail.com>
1 parent 20fb351 commit 8361e49

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

bin/automerge.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const OLD_CONFIG = [
2121
"TOKEN"
2222
];
2323

24+
const GITHUB_SERVER_URL = process.env.GITHUB_SERVER_URL;
25+
2426
async function main() {
2527
const parser = new ArgumentParser({
2628
prog: pkg.name,
@@ -53,6 +55,7 @@ async function main() {
5355
const token = env("GITHUB_TOKEN");
5456

5557
const octokit = new Octokit({
58+
baseUrl: GITHUB_SERVER_URL,
5659
auth: `token ${token}`,
5760
userAgent: "pascalgn/automerge-action"
5861
});

dist/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ const { update } = __nccwpck_require__(3056);
1919
const { merge } = __nccwpck_require__(452);
2020
const { branchName } = __nccwpck_require__(4024);
2121

22-
const URL_REGEXP =
23-
/^https:\/\/github.com\/([^/]+)\/([^/]+)\/(pull|tree)\/([^ ]+)$/;
22+
const GITHUB_SERVER_URL = process.env.GITHUB_SERVER_URL || "https://github.com";
23+
24+
const URL_REGEXP = new RegExp(
25+
`^${GITHUB_SERVER_URL}/([^/]+)/([^/]+)/(pull|tree)/([^ ]+)$`
26+
);
2427

2528
const RELEVANT_ACTIONS = [
2629
"labeled",
@@ -22949,7 +22952,7 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"]
2294922952
/***/ ((module) => {
2295022953

2295122954
"use strict";
22952-
module.exports = JSON.parse('{"name":"automerge-action","version":"0.15.5","description":"GitHub action to automatically merge pull requests","main":"lib/api.js","author":"Pascal","license":"MIT","private":true,"bin":{"automerge-action":"./bin/automerge.js"},"scripts":{"test":"jest","it":"node it/it.js","lint":"prettier -l lib/** test/** && eslint .","compile":"ncc build bin/automerge.js --license LICENSE -o dist","prepublish":"yarn lint && yarn test && yarn compile"},"dependencies":{"@actions/core":"^1.10.0","@octokit/rest":"^19.0.7","argparse":"^2.0.1","fs-extra":"^11.1.0","object-resolve-path":"^1.1.1","tmp":"^0.2.1"},"devDependencies":{"@vercel/ncc":"^0.36.1","dotenv":"^16.0.3","eslint":"^8.34.0","eslint-plugin-jest":"^27.2.1","jest":"^29.4.3","prettier":"^2.8.4"},"prettier":{"trailingComma":"none","arrowParens":"avoid"}}');
22955+
module.exports = JSON.parse('{"name":"automerge-action","version":"0.15.6","description":"GitHub action to automatically merge pull requests","main":"lib/api.js","author":"Pascal","license":"MIT","private":true,"bin":{"automerge-action":"./bin/automerge.js"},"scripts":{"test":"jest","it":"node it/it.js","lint":"prettier -l lib/** test/** && eslint .","compile":"ncc build bin/automerge.js --license LICENSE -o dist","prepublish":"yarn lint && yarn test && yarn compile"},"dependencies":{"@actions/core":"^1.10.0","@octokit/rest":"^19.0.7","argparse":"^2.0.1","fs-extra":"^11.1.0","object-resolve-path":"^1.1.1","tmp":"^0.2.1"},"devDependencies":{"@vercel/ncc":"^0.36.1","dotenv":"^16.0.3","eslint":"^8.34.0","eslint-plugin-jest":"^27.2.1","jest":"^29.4.3","prettier":"^2.8.4"},"prettier":{"trailingComma":"none","arrowParens":"avoid"}}');
2295322956

2295422957
/***/ })
2295522958

@@ -23016,6 +23019,8 @@ const OLD_CONFIG = [
2301623019
"TOKEN"
2301723020
];
2301823021

23022+
const GITHUB_SERVER_URL = process.env.GITHUB_SERVER_URL;
23023+
2301923024
async function main() {
2302023025
const parser = new ArgumentParser({
2302123026
prog: pkg.name,
@@ -23048,6 +23053,7 @@ async function main() {
2304823053
const token = env("GITHUB_TOKEN");
2304923054

2305023055
const octokit = new Octokit({
23056+
baseUrl: GITHUB_SERVER_URL,
2305123057
auth: `token ${token}`,
2305223058
userAgent: "pascalgn/automerge-action"
2305323059
});

lib/api.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ const { update } = require("./update");
1212
const { merge } = require("./merge");
1313
const { branchName } = require("./util");
1414

15-
const URL_REGEXP =
16-
/^https:\/\/github.com\/([^/]+)\/([^/]+)\/(pull|tree)\/([^ ]+)$/;
15+
const GITHUB_SERVER_URL = process.env.GITHUB_SERVER_URL || "https://github.com";
16+
17+
const URL_REGEXP = new RegExp(
18+
`^${GITHUB_SERVER_URL}/([^/]+)/([^/]+)/(pull|tree)/([^ ]+)$`
19+
);
1720

1821
const RELEVANT_ACTIONS = [
1922
"labeled",

0 commit comments

Comments
 (0)