Skip to content

Commit

Permalink
fix: return uploadUrl and body when creating release (#1298)
Browse files Browse the repository at this point in the history
  • Loading branch information
chingor13 committed Feb 14, 2022
1 parent e673eb5 commit 5d767c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export interface GitHubRelease {
notes?: string;
url: string;
draft?: boolean;
uploadUrl?: string;
}

export interface GitHubTag {
Expand Down Expand Up @@ -1246,9 +1247,14 @@ export class GitHub {
name: resp.data.name || undefined,
tagName: resp.data.tag_name,
sha: resp.data.target_commitish,
notes: resp.data.body_text,
notes:
resp.data.body_text ||
resp.data.body ||
resp.data.body_html ||
undefined,
url: resp.data.html_url,
draft: resp.data.draft,
uploadUrl: resp.data.upload_url,
};
},
e => {
Expand Down
5 changes: 5 additions & 0 deletions test/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ describe('GitHub', () => {
upload_url:
'https://uploads.github.com/repos/fake/fake/releases/1/assets{?name,label}',
target_commitish: 'abc123',
body: 'Some release notes response.',
});
const release = await github.createRelease({
tag: new TagName(Version.parse('1.2.3')),
Expand All @@ -625,6 +626,10 @@ describe('GitHub', () => {
expect(release.tagName).to.eql('v1.2.3');
expect(release.sha).to.eql('abc123');
expect(release.draft).to.be.false;
expect(release.uploadUrl).to.eql(
'https://uploads.github.com/repos/fake/fake/releases/1/assets{?name,label}'
);
expect(release.notes).to.eql('Some release notes response.');
});

it('should raise a DuplicateReleaseError if already_exists', async () => {
Expand Down

0 comments on commit 5d767c5

Please sign in to comment.