Skip to content

Commit ede6c15

Browse files
7Hazardgr2m
andauthored
feat: add GitHub Enterprise Server (GHES) support (actions#36)
This adds support for this action to be used in GitHub Enterprise Server. It sends request to the base url extracted from [GITHUB_API_URL](https://docs.github.com/en/enterprise-server@3.10/actions/learn-github-actions/variables#default-environment-variables). --------- Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
1 parent 17cde8a commit ede6c15

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

lib/post.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export async function post(core, request) {
1111
const token = core.getState("token");
1212

1313
if (!token) return;
14-
14+
1515
await request("DELETE /installation/token", {
1616
headers: {
1717
authorization: `token ${token}`,

main.js

+13-6
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,16 @@ const privateKey = core.getInput("private_key");
1515

1616
const repository = process.env.GITHUB_REPOSITORY;
1717

18-
main(appId, privateKey, repository, core, createAppAuth, request).catch(
19-
(error) => {
20-
console.error(error);
21-
core.setFailed(error.message);
22-
}
23-
);
18+
main(
19+
appId,
20+
privateKey,
21+
repository,
22+
core,
23+
createAppAuth,
24+
request.defaults({
25+
baseUrl: process.env["GITHUB_API_URL"],
26+
})
27+
).catch((error) => {
28+
console.error(error);
29+
core.setFailed(error.message);
30+
});

post.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ import { request } from "@octokit/request";
55

66
import { post } from "./lib/post.js";
77

8-
post(core, request).catch(
9-
(error) => {
10-
console.error(error);
11-
core.setFailed(error.message);
12-
}
13-
);
8+
post(
9+
core,
10+
request.defaults({
11+
baseUrl: process.env["GITHUB_API_URL"],
12+
})
13+
).catch((error) => {
14+
console.error(error);
15+
core.setFailed(error.message);
16+
});

0 commit comments

Comments
 (0)