Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from target/update-connectors
Browse files Browse the repository at this point in the history
bug fix: More Flexible Github Connector
  • Loading branch information
therynamo authored Aug 16, 2018
2 parents 5ab2986 + 5ab9e3f commit f444e8e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ my-release-log-step:
- `github_tag_id` - you can use this as regex to match on specific tags.
- `slack_channel`/`SLACK_URL` - when using the API, you should use `slack_channel` to specify which room you'd like to post to. When using `SLACK_URL` you should not specify the room (i.e. `slack_channel`) because the room is already a part of the webhook. ([Setting Up A Webhook (e.g. SLACK_URL)](https://api.slack.com/incoming-webhooks), [Setting Up A Slack Token](https://api.slack.com/docs/token-types#verification))
- `teams` - a list of teams which allows you to organize the output of Captains Log into meaningful chunks. (more below)
- `enterprise_host` - if you use Enterprise Github, this is where you would supply the custom domain. (e.g. https://git.myCompany.com)

**Example of `github_tag_id`**

Expand Down
2 changes: 1 addition & 1 deletion config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"timeout": 0,
"token": "<REPLACE_ME>",
"host": "https://github.com/api/v3",
"domain": "https://github.com"
"domain": null
},
"slack": {
"channel": "<REPLACE_ME>",
Expand Down
2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ nconf.set('development', process.env.NODE_ENV === DEVELOPMENT);
nconf.set('regexp', process.env.PLUGIN_REGEXP);

// Github
nconf.set('github:domain', process.env.PLUGIN_GITHUB_DOMAIN);
nconf.set('github:domain', process.env.PLUGIN_ENTERPRISE_HOST);
nconf.set('github:host', process.env.PLUGIN_GITHUB_HOST);
nconf.set('github:token', process.env.GITHUB_TOKEN);
nconf.set('github:owner', process.env.PLUGIN_GITHUB_OWNER);
Expand Down
9 changes: 7 additions & 2 deletions src/connectors/GithubConnector.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
const Github = require('@octokit/rest');
const config = require('../config');

const { host, timeout, token } = config.get('github');
const {
domain,
host,
timeout,
token,
} = config.get('github');

const accepts = [
'application/vnd.github.v3+json',
Expand All @@ -18,7 +23,7 @@ const github = new Github({
accept: accepts.join(','),
'user-agent': 'octokit/rest v15.8.1',
},
baseUrl: host,
baseUrl: domain || host,
});

github.authenticate({
Expand Down

0 comments on commit f444e8e

Please sign in to comment.