Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
test: add test and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgoncalves committed Dec 15, 2023
1 parent c935063 commit 91a14af
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ See [Conventional Commits](https://www.conventionalcommits.org/) for sample titl
**Optional.** URL to be used when linking the "Details" in the actions overview.
> Default: `"https://www.conventionalcommits.org/en/v1.0.0/#summary"`.
### `scope-required`

**Optional.** Set to `true` if you want to fail in case the scope isn't set.
> Default: `false`.
## Outputs

### `success`
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ inputs:
required: false
default: https://www.conventionalcommits.org/en/v1.0.0/#summary
scope-required:
description: Set to true if you want to fail in case the scope isn't set
description: Set to true if you want to fail in case the scope isn't set.
required: false
default: false
type: boolean
Expand Down
6 changes: 6 additions & 0 deletions src/validateTitle.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ it('throws for PR titles with an unknown type', async () => {
/Unknown release type "foo" found in pull request title "foo: Bar"./
);
});

it('throws for PR titles without a scope when its required', async () => {
await expect(validateTitle(preset, 'feat: Add feature', true)).rejects.toThrow(
/No scope found in pull request title "feat: Add feature" but it's required./
);
});

0 comments on commit 91a14af

Please sign in to comment.