Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0e41c38

Browse files
author
skedwards88
committed
update to work with GHES
1 parent19db120 commit0e41c38

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

‎Readme.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This sample app showcases how webhooks can be used with a GitHub App's installat
1414
##Setup
1515

1616
1. Clone this repository.
17-
2. Create a`.env` file similar to`.env.example` and set actual values.
17+
2. Create a`.env` file similar to`.env.example` and set actual values. If you are using GitHub Enterprise Server, also include a`ENTERPRISE_HOSTNAME` variable and set the value to the name of your GitHub Enterprise Server instance.
1818
3. Install dependencies with`npm install`.
1919
4. Start the server with`npm run server`.
2020
5. Ensure your server is reachable from the internet.

‎app.js‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,22 @@ const appId = process.env.APP_ID;
1212
constprivateKeyPath=process.env.PRIVATE_KEY_PATH;
1313
constprivateKey=fs.readFileSync(privateKeyPath,"utf8");
1414
constsecret=process.env.WEBHOOK_SECRET;
15+
constenterpriseHostname=process.env.ENTERPRISE_HOSTNAME;
1516
constmessageForNewPRs=fs.readFileSync("./message.md","utf8");
1617

1718
// Create an authenticated Octokit client authenticated as a GitHub App
18-
constapp=newApp({ appId, privateKey,webhooks:{ secret}});
19+
constapp=newApp({
20+
appId:appId,
21+
privateKey:privateKey,
22+
webhooks:{
23+
secret:secret
24+
},
25+
...(enterpriseHostname&&{
26+
Octokit:Octokit.defaults({
27+
baseUrl:`https://${enterpriseHostname}/api/v3`,
28+
}),
29+
}),
30+
})
1931

2032
// Optional: Get & log the authenticated app's name
2133
const{ data}=awaitapp.octokit.request("/app");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp