Skip to content

Commit

Permalink
feat: Force CJS using node runner
Browse files Browse the repository at this point in the history
  • Loading branch information
kevintyj committed Jun 23, 2024
1 parent 59797d1 commit 39eaa35
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions __tests__/log.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ describe('logger', () => {
it('log with title and error to return the correct string', () => {
expect(logWithTile('title', 'error')).toBe('title\n=====================\nerror');
});
it('log with title and empty content to throw error', () => {
expect(() => logWithTile('title', '')).toThrow('Content is empty');
});
});
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ author: Kevin Taeyoon Jin <hello@kevintyj.com>
description: Ensure PR title match commitlint config
runs:
using: node20
main: dist/index.js
main: node dist/index.js --entry-type=commonjs
inputs:
cl-config:
description: Path to commit lint config (commitlint.config.js)
Expand Down
4 changes: 4 additions & 0 deletions src/log.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const SEPARATOR: string = '=====================';

function logWithTile(title: string, content: string): string {
if (content === '')
throw new Error('Content is empty');

return `${title}\n${SEPARATOR}\n${content}`;
}
export default logWithTile;

0 comments on commit 39eaa35

Please sign in to comment.