Skip to content

Commit

Permalink
Merge pull request #120 from patricklx/patch-1
Browse files Browse the repository at this point in the history
make name of release the same as the tag
  • Loading branch information
mansona authored Feb 12, 2025
2 parents 6565cda + 7439024 commit 81e2094
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
36 changes: 35 additions & 1 deletion src/publish.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect, vi } from 'vitest';
import { npmPublish, IssueReporter } from './publish.js';
import { npmPublish, createGithubRelease, IssueReporter } from './publish.js';
import { Solution } from './plan.js';

// we aren't currently using this so we can just ignore for now
Expand Down Expand Up @@ -181,4 +181,38 @@ describe('publish', function () {
`);
});
});

describe('createGithubRelease', function () {
it('calls octokit create Release with correct params', async function () {
const octokit = {
repos: {
getReleaseByTag() {
const err = new Error() as any;
err.status = 404;
throw err;
},
createRelease: vi.fn(),
},
};
await createGithubRelease(
octokit as any,
'new release',
'v1.0.0-release-plan',
reporter,
{},
);
expect(octokit.repos.createRelease.mock.calls.length).toBe(1);
expect(octokit.repos.createRelease.mock.lastCall).toMatchInlineSnapshot(`
[
{
"body": "new release",
"name": "v1.0.0-release-plan",
"owner": "embroider-build",
"repo": "release-plan",
"tag_name": "v1.0.0-release-plan",
},
]
`);
});
});
});
3 changes: 2 additions & 1 deletion src/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ async function doesReleaseExist(
}
}

async function createGithubRelease(
export async function createGithubRelease(
octokit: Octokit,
description: string,
tagName: string,
Expand Down Expand Up @@ -192,6 +192,7 @@ async function createGithubRelease(
owner,
repo,
tag_name: tagName,
name: tagName,
body: description,
});
} catch (err) {
Expand Down

0 comments on commit 81e2094

Please sign in to comment.