Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ class Build {
error (message, url) {return update(this.meta, message, url, 'error')}
}

const default_git_url = "https://api.github.com"

const update = (build, message, url, status) => new Promise((resolve, reject) => {
axios({
method: 'POST',
url: `https://api.github.com/repos/${build.repo}/statuses/${build.sha}`,
url: `${build.ghe ? `${build.ghe}/api/v3` : default_git_url }/repos/${build.repo}/statuses/${build.sha}`,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does ghe come from? 🤔

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rahulgandhi can you respond to this?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I think ghe comes from Build instance meta.

E.g.:

const data = {
  ...
  ghe: '...',
}

/* Create a build */
const build = new Build(data)

Although, IMAO ghe is not obvious. Maybe ghEnterpriseUrl?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, one should be allowed to configure the entire thing. In other projects i've seen them separated out as:

GH_PREFIX and GH_URL (as env vars, for example). Makes for easier separate consumption.

GH_PREFIX being /api/v3 and GH_URL being https://github.mydomain.com

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @rahulgandhi, do you have time to update this?

responseType: 'json',
data: {
state: status,
Expand Down