Skip to content

Commit

Permalink
refactor: semantic naming rule messages (#25)
Browse files Browse the repository at this point in the history
* refactor: semantic naming rule messages

* docs: update semantic pr title documentation
  • Loading branch information
nejdetkadir authored Oct 25, 2023
1 parent a29cfdb commit b5e3478
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions docs/SEMANTIC_TITLE_NAMING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## Semantic Title Naming

#### PR Title Convention
`scope: description`
`scope(sub-scope): description`


#### PR Title Rules
- PR title must be start with a scope.

#### Allowed Scopes
- build
- chore
- ci
- docs
- feat
- fix
- perf
- refactor
- revert
- style
- test

#### Scope Meaning
- **build:** Changes that affect the build system or external dependencies.
- **chore:** Changes to unrelated tasks.
- **ci:** Changes to our CI configuration files and scripts.
- **docs:** Documentation only changes.
- **feat:** A new feature.
- **fix:** A bug fix.
- **perf:** A code change that improves performance.
- **refactor:** A code change that neither fixes a bug nor adds a feature.
- **revert:** Reverts a previous commit.
- **style:** Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc).
- **test:** Adding missing tests or correcting existing tests.


#### Examples

**Valid PR Titles**
- `docs: update Readme`
- `feat: add new feature`
- `fix: login bug`
- `fix: login bug with task id [PLM-123]`

**Invalid PR Titles**
- `update Readme`
- `add new feature`
- `bug: login bug`
- `fix: login bug with task id PLM-123`
2 changes: 1 addition & 1 deletion src/lib/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async function commentAndClosePR() {
await octokit.rest.issues.createComment({
...github.context.repo,
issue_number: github.context.issue.number,
body: `BOT MESSAGE :robot:\n\n\nPlease follow the semantic branch naming convention :construction:\n\n\n@${PROwner}`
body: `BOT MESSAGE :robot:\n\n\nPlease follow the semantic branch naming convention :construction:\n\nSee the [Semantic Branch Name Documentation](https://github.com/shftco/shft-pullmate/blob/main/docs/SEMANTIC_BRANCH_NAMING.md) for more information.\n\n\n@${PROwner}`
});

await octokit.rest.pulls.update({
Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export async function run(): Promise<void> {
}

if (await pullRequest.missingSemanticTitle()) {
errors.push('Pull request must have a semantic title.');
errors.push(
'Pull request must have a semantic title. See the [Semantic Title Documentation](https://github.com/shftco/shft-pullmate/blob/main/docs/SEMANTIC_TITLE_NAMING.md) for more information.'
);
}

if (await pullRequest.missingReviewers()) {
Expand Down

0 comments on commit b5e3478

Please sign in to comment.