@@ -374,6 +374,39 @@ describe('publish:github', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should lowercase topics when provided', async () => {
|
||||
mockGithubClient.users.getByUsername.mockResolvedValue({
|
||||
data: { type: 'User' },
|
||||
});
|
||||
|
||||
mockGithubClient.repos.createForAuthenticatedUser.mockResolvedValue({
|
||||
data: {
|
||||
clone_url: 'https://github.com/clone/url.git',
|
||||
html_url: 'https://github.com/html/url',
|
||||
},
|
||||
});
|
||||
|
||||
mockGithubClient.repos.replaceAllTopics.mockResolvedValue({
|
||||
data: {
|
||||
names: ['backstage'],
|
||||
},
|
||||
});
|
||||
|
||||
await action.handler({
|
||||
...mockContext,
|
||||
input: {
|
||||
...mockContext.input,
|
||||
topics: ['BACKSTAGE'],
|
||||
},
|
||||
});
|
||||
|
||||
expect(mockGithubClient.repos.replaceAllTopics).toHaveBeenCalledWith({
|
||||
owner: 'owner',
|
||||
repo: 'repo',
|
||||
names: ['backstage'],
|
||||
});
|
||||
});
|
||||
|
||||
it('should call output with the remoteUrl and the repoContentsUrl', async () => {
|
||||
mockGithubClient.users.getByUsername.mockResolvedValue({
|
||||
data: { type: 'User' },
|
||||
|
||||
@@ -102,7 +102,6 @@ export function createPublishGithubAction(options: {
|
||||
},
|
||||
topics: {
|
||||
title: 'Topics',
|
||||
description: 'Uppercase letters no allowed',
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
@@ -230,7 +229,7 @@ export function createPublishGithubAction(options: {
|
||||
await client.repos.replaceAllTopics({
|
||||
owner,
|
||||
repo,
|
||||
names: topics,
|
||||
names: topics.map(t => t.toLowerCase()),
|
||||
});
|
||||
} catch (e) {
|
||||
ctx.logger.warn(`Skipping topics ${topics.join(' ')}, ${e.message}`);
|
||||
|
||||
Reference in New Issue
Block a user