Skip to content

Commit

Permalink
feat: refactor to accept --proxy-key and --api-url (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe authored May 31, 2019
1 parent 052c902 commit e2c4603
Show file tree
Hide file tree
Showing 8 changed files with 233 additions and 152 deletions.
2 changes: 1 addition & 1 deletion __snapshots__/release-pr.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

115 changes: 96 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
},
"dependencies": {
"@octokit/graphql": "^2.1.2",
"@octokit/request": "^4.1.0",
"@octokit/rest": "^16.24.1",
"chalk": "^2.4.2",
"concat-stream": "^2.0.0",
Expand Down
9 changes: 9 additions & 0 deletions src/bin/release-please.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ action "github-release" {
default: false,
type: 'boolean',
})
.option('api-url', {
describe: 'URL to use when making API requests',
default: 'https://api.github.com',
type: 'string',
})
.option('proxy-key', {
describe: 'key used by some GitHub proxies',
type: 'string',
})
.demandCommand(1)
.strict(true)
.parse();
5 changes: 4 additions & 1 deletion src/github-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,19 @@ export interface GitHubReleaseOptions {
label: string;
repoUrl: string;
token: string;
apiUrl: string;
}

export class GitHubRelease {
apiUrl: string;
changelogPath: string;
gh: GitHub;
labels: string[];
repoUrl: string;
token: string | undefined;

constructor(options: GitHubReleaseOptions) {
this.apiUrl = options.apiUrl;
this.labels = options.label.split(',');
this.repoUrl = options.repoUrl;
this.token = options.token;
Expand Down Expand Up @@ -88,7 +91,7 @@ export class GitHubRelease {

private gitHubInstance(): GitHub {
const [owner, repo] = parseGithubRepoUrl(this.repoUrl);
return new GitHub({ token: this.token, owner, repo });
return new GitHub({ token: this.token, owner, repo, apiUrl: this.apiUrl });
}

static extractLatestReleaseNotes(
Expand Down
Loading

0 comments on commit e2c4603

Please sign in to comment.