Skip to content

Commit 1257edb

Browse files
ci: Add PR lint to repo (#93)
1 parent f14f329 commit 1257edb

File tree

2 files changed

+90
-1
lines changed

2 files changed

+90
-1
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: pull-request-lint
2+
on:
3+
pull_request_target:
4+
types:
5+
- labeled
6+
- opened
7+
- synchronize
8+
- reopened
9+
- ready_for_review
10+
- edited
11+
pull_request:
12+
types:
13+
- labeled
14+
- opened
15+
- synchronize
16+
- reopened
17+
- ready_for_review
18+
- edited
19+
jobs:
20+
validate:
21+
name: Validate PR title
22+
runs-on: ubuntu-latest
23+
permissions:
24+
pull-requests: write
25+
steps:
26+
- uses: amannn/action-semantic-pull-request@v5
27+
id: lint_pr_title
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
with:
31+
types: |-
32+
feat
33+
fix
34+
chore
35+
doc
36+
test
37+
security
38+
remove
39+
deprecate
40+
refactor
41+
perf
42+
ci
43+
revert
44+
style
45+
requireScope: false
46+
- uses: marocchino/sticky-pull-request-comment@v2
47+
# When the previous steps fails, the workflow would stop. By adding this
48+
# condition you can continue the execution with the populated error message.
49+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
50+
with:
51+
header: pr-title-lint-error
52+
message: |
53+
Hey there and thank you for opening this pull request! 👋🏼
54+
55+
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
56+
57+
Details: [CONTRIBUTING.md](https://github.com/mongodb/awscdk-resources-mongodbatlas/blob/INTMDB-934/CONTRIBUTING.md#pr-title-format)
58+
59+
```
60+
${{ steps.lint_pr_title.outputs.error_message }}
61+
```
62+
# Delete a previous comment when the issue has been resolved
63+
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
64+
uses: marocchino/sticky-pull-request-comment@v2
65+
with:
66+
header: pr-title-lint-error
67+
delete: true
68+

CONTRIBUTING.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,35 @@ After the above steps are completed and we've agreed on a path forward:
1111
4. Commit and push your changes to your branch then submit a pull request against the current release branch, not master. The naming scheme of the branch is `release-staging-v#.#.#`. **Note**: There will only be one release branch at a time.
1212
5. A repo maintainer will review the your pull request, and may either request additional changes or merge the pull request.
1313

14+
## PR Title Format
15+
We use [*Conventional Commits*](https://www.conventionalcommits.org/):
16+
- `fix: description of the PR`: a commit of the type fix patches a bug in your codebase (this correlates with PATCH in Semantic Versioning).
17+
- `chore: description of the PR`: the commit includes a technical or preventative maintenance task that is necessary for managing the product or the repository, but it is not tied to any specific feature or user story (this correlates with PATCH in Semantic Versioning).
18+
- `doc: description of the PR`: The commit adds, updates, or revises documentation that is stored in the repository (this correlates with PATCH in Semantic Versioning).
19+
- `test: description of the PR`: The commit enhances, adds to, revised, or otherwise changes the suite of automated tests for the product (this correlates with PATCH in Semantic Versioning).
20+
- `security: description of the PR`: The commit improves the security of the product or resolves a security issue that has been reported (this correlates with PATCH in Semantic Versioning).
21+
- `refactor: description of the PR`: The commit refactors existing code in the product, but does not alter or change existing behavior in the product (this correlates with Minor in Semantic Versioning).
22+
- `perf: description of the PR`: The commit improves the performance of algorithms or general execution time of the product, but does not fundamentally change an existing feature (this correlates with Minor in Semantic Versioning).
23+
- `ci: description of the PR`: The commit makes changes to continuous integration or continuous delivery scripts or configuration files (this correlates with Minor in Semantic Versioning).
24+
- `revert: description of the PR`: The commit reverts one or more commits that were previously included in the product, but were accidentally merged or serious issues were discovered that required their removal from the main branch (this correlates with Minor in Semantic Versioning).
25+
- `style: description of the PR`: The commit updates or reformats the style of the source code, but does not otherwise change the product implementation (this correlates with Minor in Semantic Versioning).
26+
- `feat: description of the PR`: a commit of the type feat introduces a new feature to the codebase (this correlates with MINOR in Semantic Versioning).
27+
- `deprecate: description of the PR`: The commit deprecates existing functionality, but does not remove it from the product (this correlates with MINOR in Semantic Versioning).
28+
- `BREAKING CHANGE`: a commit that has a footer BREAKING CHANGE:, or appends a ! after the type/scope, introduces a breaking API change (correlating with MAJOR in Semantic Versioning). A BREAKING CHANGE can be part of commits of any type.
29+
Examples:
30+
- `fix!: description of the ticket`
31+
- If the PR has `BREAKING CHANGE`: in its description is a breaking change
32+
- `remove!: description of the PR`: The commit removes a feature from the product. Typically features are deprecated first for a period of time before being removed. Removing a feature is a breaking change (correlating with MAJOR in Semantic Versioning).
33+
34+
1435
## Autoclose stale issues and PRs
1536
- After 30 days of no activity (no comments or commits are on an issue or PR) we automatically tag it as “stale” and add a message: "This issue has gone 30 days without any activity and meets the project’s definition of ‘stale’. This will be auto-closed if there is no new activity over the next 30 days. If the issue is still relevant and active, you can simply comment with a “bump” to keep it open, or add the “[Status] Not Stale” label. Thanks for keeping our repository healthy!"
1637
- After 30 more days of no activity we automatically close the issue / PR.
1738

1839
## Release and Publishing
1940
### Manual Release
2041
1. `projenrc` is set to do manual release.
21-
2. The release process is based on *Semantic Versioning* and *Conventional Commits* (https://www.conventionalcommits.org/).
42+
2. The release process is based on [*Semantic Versioning*](https://semver.org/) and [*Conventional Commits*](https://www.conventionalcommits.org/).
2243
3. Make sure to follow the above guidelines in order to bump appropriate part of the version (*MAJOR, MINOR, PATCH*).
2344
4. Commit the changes with the message based on the conventional commits guidelines.
2445

0 commit comments

Comments
 (0)