Skip to content

Commit 46169d0

Browse files
authored
ci: add changelog reminder (#15459)
1 parent b77e51a commit 46169d0

File tree

9 files changed

+254
-42
lines changed

9 files changed

+254
-42
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ please add links to any relevant follow up issues.*
2121

2222
I have...
2323

24-
- [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
25-
- [ ] added `!` to the type prefix if API or client breaking change
26-
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting))
27-
- [ ] provided a link to the relevant issue or specification
28-
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules)
29-
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing)
30-
- [ ] added a changelog entry to `CHANGELOG.md`
31-
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
32-
- [ ] updated the relevant documentation or specification
33-
- [ ] reviewed "Files changed" and left comments if necessary
34-
- [ ] confirmed all CI checks have passed
24+
* [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
25+
* [ ] added `!` to the type prefix if API or client breaking change
26+
* [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting))
27+
* [ ] provided a link to the relevant issue or specification
28+
* [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules)
29+
* [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing)
30+
* [ ] added a changelog entry to `CHANGELOG.md`
31+
* [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
32+
* [ ] updated the relevant documentation or specification
33+
* [ ] reviewed "Files changed" and left comments if necessary
34+
* [ ] confirmed all CI checks have passed
3535

3636
### Reviewers Checklist
3737

@@ -40,11 +40,11 @@ your handle next to the items reviewed if you only reviewed selected items.*
4040

4141
I have...
4242

43-
- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
44-
- [ ] confirmed `!` in the type prefix if API or client breaking change
45-
- [ ] confirmed all author checklist items have been addressed
46-
- [ ] reviewed state machine logic
47-
- [ ] reviewed API design and naming
48-
- [ ] reviewed documentation is accurate
49-
- [ ] reviewed tests and test coverage
50-
- [ ] manually tested (if applicable)
43+
* [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
44+
* [ ] confirmed `!` in the type prefix if API or client breaking change
45+
* [ ] confirmed all author checklist items have been addressed
46+
* [ ] reviewed state machine logic
47+
* [ ] reviewed API design and naming
48+
* [ ] reviewed documentation is accurate
49+
* [ ] reviewed tests and test coverage
50+
* [ ] manually tested (if applicable)
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Checks if a changelog is missing in the PR diff
2+
name: Changelog Reminder
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
paths: ["**/*.go"]
7+
permissions:
8+
pull-requests: write
9+
jobs:
10+
remind:
11+
name: Changelog Reminder
12+
runs-on: ubuntu-latest
13+
# Skip draft PRs and PRs starting with: revert, test, chore, ci, docs, style, build, refactor
14+
if: ${{ !github.event.pull_request.draft }} && !contains(github.event.pull_request.title, 'revert') && !contains(github.event.pull_request.title, 'test') && !contains(github.event.pull_request.title, 'chore') && !contains(github.event.pull_request.title, 'ci') && !contains(github.event.pull_request.title, 'docs') && !contains(github.event.pull_request.title, 'style') && !contains(github.event.pull_request.title, 'build') && !contains(github.event.pull_request.title, 'refactor')
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: mskelton/changelog-reminder-action@v3
18+
with:
19+
message: "@${{ github.actor }} your pull request is missing a changelog!"

.github/workflows/lint-pr.yml

+27-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,35 @@ permissions:
1313
jobs:
1414
main:
1515
permissions:
16-
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
17-
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
16+
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
17+
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: amannn/[email protected]
21+
id: lint_pr_title
2122
env:
2223
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- uses: marocchino/sticky-pull-request-comment@v2
26+
# When the previous steps fails, the workflow would stop. By adding this
27+
# condition you can continue the execution with the populated error message.
28+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
29+
with:
30+
header: pr-title-lint-error
31+
message: |
32+
Hey there and thank you for opening this pull request! 👋🏼
33+
34+
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.
35+
36+
Details:
37+
38+
```
39+
${{ steps.lint_pr_title.outputs.error_message }}
40+
```
41+
42+
# Delete a previous comment when the issue has been resolved
43+
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
44+
uses: marocchino/sticky-pull-request-comment@v2
45+
with:
46+
header: pr-title-lint-error
47+
delete: true

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ go.sum: go.mod
187187

188188
godocs:
189189
@echo "--> Wait a few seconds and visit http://localhost:6060/pkg/github.com/cosmos/cosmos-sdk/types"
190+
go install golang.org/x/tools/cmd/godoc@latest
190191
godoc -http=:6060
191192

192193
build-docs:

cliff.toml

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# configuration file for git-cliff (0.1.0)
2+
3+
[changelog]
4+
# changelog header
5+
header = """
6+
<!--
7+
Guiding Principles:
8+
9+
Changelogs are for humans, not machines.
10+
There should be an entry for every single version.
11+
The same types of changes should be grouped.
12+
Versions and sections should be linkable.
13+
The latest version comes first.
14+
The release date of each version is displayed.
15+
Mention whether you follow Semantic Versioning.
16+
17+
Usage:
18+
19+
Changelog entries are generated by git cliff ref: https://github.com/orhun/git-cliff
20+
21+
Each commit should be conventional, the following message groups are supported.
22+
23+
* feat: A new feature
24+
* fix: A bug fix
25+
* docs: Documentation only changes
26+
* style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
27+
* refactor: A code change that neither fixes a bug nor adds a feature
28+
* perf: A code change that improves performance
29+
* test: Adding missing tests or correcting existing tests
30+
* build: Changes that affect the build system or external dependencies (example scopes: go, npm)
31+
* ci: Changes to our CI configuration files and scripts (example scopes: GH Actions)
32+
* chore: Other changes that don't modify src or test files
33+
* revert: Reverts a previous commit
34+
35+
When a change is made that affects the API or state machine, the commit message prefix should be suffixed with `!`.
36+
37+
Ref: https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json
38+
-->
39+
40+
# Changelog
41+
42+
"""
43+
# template for the changelog body
44+
body = """
45+
{% if version %}\
46+
## [{{ version }}](https://github.com/cosmos/cosmos-sdk/releases/tag/{{version}}) - {{ timestamp | date(format="%Y-%m-%d") }}
47+
{% else %}\
48+
## [Unreleased]
49+
{% endif %}\
50+
{% for group, commits in commits | group_by(attribute="group") %}
51+
### {{ group | striptags | trim | upper_first }}
52+
{% for commit in commits %}
53+
* {{ commit.message | upper_first }}\
54+
{% endfor %}
55+
{% endfor %}\n
56+
"""
57+
# remove the leading and trailing whitespace from the template
58+
trim = true
59+
# changelog footer
60+
footer = """
61+
<!-- generated by git-cliff -->
62+
"""
63+
64+
[git]
65+
# parse the commits based on https://www.conventionalcommits.org
66+
conventional_commits = true
67+
# filter out the commits that are not conventional
68+
filter_unconventional = true
69+
# process each line of a commit as an individual commit
70+
split_commits = true
71+
# regex for preprocessing the commit messages
72+
commit_preprocessors = [
73+
{ pattern = '.*', replace_command = 'sed -E "s/^(\S+)\s(.+)\s\((#[0-9]+)\)$/\1 (\3) \2/"' },
74+
# A reference to an issue is appened to commits that looks like "(#1234)", this will be replaced
75+
# with a link to that issue, e.g. "[#$1234](https://github.com/cosmos/cosmos-sdk/issues/1234)".
76+
{ pattern = '\(#(\d+)\)', replace = "[#${1}](https://github.com/cosmos/cosmos-sdk/issues/${1})" },
77+
# replace multiple spaces with one space
78+
{ pattern = " +", replace = " "},
79+
80+
# the following patterns only exist because "split_commits" is set to true, and we are processesing
81+
# each line of the commit as a separate message.
82+
# these exist to filter out common messages that appear in commit messages that are technically
83+
# conventional, but we do not way to include in the changelog.
84+
{ pattern = '^Signed-off-by:.*', replace='' },
85+
{ pattern = '^Co-authored-by:.*', replace='' },
86+
# don't include references to issues as changelog entries.
87+
{ pattern = '^ref:.*', replace='' },
88+
# exclude CVSS format, CVE can still be included in regular conventinal commits.
89+
{ pattern = 'CVSS:.*', replace='' },
90+
# don't include dependabot auto merge entries.
91+
{ pattern = '.*dependabot-automerge-.*', replace='' },
92+
# don't include statements saying which issue is closed.
93+
{ pattern = '^closes:.*|Closes:.*', replace='' },
94+
# remove standalone links in the commit messages.
95+
{ pattern = '^https://.*', replace='' },
96+
# remove lines with html.
97+
{ pattern = '^<.*', replace='' },
98+
]
99+
100+
# regex for parsing and grouping commits
101+
commit_parsers = [
102+
# specifying the number in a comment is a workaround to enable ordering of groups.
103+
# these comments are stripped out of the markdown with the filter "{{ group | striptags | trim | upper_first }}"
104+
# above in the body template.
105+
{ message = "^((?i)feature|(?i)feat)", group = "<!-- 0 -->Features" },
106+
{ message = "^((?i)improvements|(?i)imp|(?i)impr|(?i)perf)", group = "<!-- 1 -->Improvements" },
107+
{ message = "^((?i)fix|(?i)bug)", group = "<!-- 2 -->Bug Fixes" },
108+
{ message = '^.*\(api\)!', group = "<!-- 3 -->API Breaking" },
109+
{ message = '^.*\(statemachine\)!', group = "<!-- 4 -->State Machine Breaking" },
110+
{ message = "^((?i)test)", group = "<!-- 5 -->Testing" },
111+
{ message = "^((?i)doc|(?i)docs|(?i)documentation)", group = "<!-- 6 -->Documentation" },
112+
{ message = "^((?i)deprecated)", group = "<!-- 7 -->Deprecated" },
113+
{ message = "^((?i)deps|(?i)dep|(?i)build)", group = "<!-- 8 -->Dependencies" },
114+
{ message = "^revert|^ci|^chore|^refactor", skip = true} # explicitly skips changelog for reverts, CI, chore and refactor commits
115+
]
116+
# filter out the commits that are not matched by commit parsers
117+
filter_commits = true
118+
# glob pattern for matching git tags
119+
# note SDK tags are purposely ignored, only submodules are included.
120+
tag_pattern = "**/v[0-9]*"
121+
# regex for skipping tags
122+
skip_tags = ""
123+
# regex for ignoring tags
124+
ignore_tags = ""
125+
# sort the tags chronologically
126+
date_order = false
127+
# sort the commits inside sections by oldest/newest order
128+
sort_commits = "newest"

contrib/devtools/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ $(RUNSIM):
6363
@go install github.com/cosmos/tools/cmd/[email protected]
6464

6565
tools-clean:
66-
rm -f $(STATIK) $(GOLANGCI_LINT) $(RUNSIM)
66+
rm -f $(GOLANGCI_LINT) $(RUNSIM)
6767
rm -f tools-stamp
6868

6969
.PHONY: tools-clean runsim

contrib/githooks/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ f_check_cmds
2525
if [[ $STAGED_GO_FILES != "" ]]; then
2626
f_echo_stderr "[pre-commit] fmt'ing staged files..."
2727
for file in $STAGED_GO_FILES; do
28-
if [[ $file =~ vendor/ ]] || [[ $file =~ client/docs/statik/ ]] || [[ $file =~ tests/mocks/ ]] || [[ $file =~ \.pb\.go ]]; then
28+
if [[ $file =~ vendor/ ]] || [[ $file =~ tests/mocks/ ]] || [[ $file =~ \.pb\.go ]]; then
2929
continue
3030
fi
3131

math/CHANGELOG.md

+58-17
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,69 @@ Mention whether you follow Semantic Versioning.
1111
1212
Usage:
1313
14-
Change log entries are to be added to the Unreleased section under the
15-
appropriate stanza (see below). Each entry should ideally include a tag and
16-
the Github issue reference in the following format:
14+
Changelog entries are generated by git cliff ref: https://github.com/orhun/git-cliff
1715
18-
* (<tag>) [#<issue-number>] Changelog message.
16+
Each commit should be conventional, the following message groups are supported.
1917
20-
Types of changes (Stanzas):
18+
* feat: A new feature
19+
* fix: A bug fix
20+
* docs: Documentation only changes
21+
* style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
22+
* refactor: A code change that neither fixes a bug nor adds a feature
23+
* perf: A code change that improves performance
24+
* test: Adding missing tests or correcting existing tests
25+
* build: Changes that affect the build system or external dependencies (example scopes: go, npm)
26+
* ci: Changes to our CI configuration files and scripts (example scopes: GH Actions)
27+
* chore: Other changes that don't modify src or test files
28+
* revert: Reverts a previous commit
2129
22-
"Features" for new features.
23-
"Improvements" for changes in existing functionality.
24-
"Deprecated" for soon-to-be removed features.
25-
"Bug Fixes" for any bug fixes.
26-
"API Breaking" for breaking exported APIs used by developers building on SDK.
27-
Ref: https://keepachangelog.com/en/1.0.0/
30+
When a change is made that affects the API or state machine, the commit message prefix should be suffixed with `!`.
31+
32+
Ref: https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json
2833
-->
2934

3035
# Changelog
3136

32-
## [Unreleased]
37+
## [math/v1.0.0-rc.0](https://github.com/cosmos/cosmos-sdk/releases/tag/math/v1.0.0-rc.0) - 2023-03-13
38+
39+
### Features
40+
41+
* [#15043](https://github.com/cosmos/cosmos-sdk/issues/15043) add rand funcs to math
42+
43+
### Bug Fixes
44+
45+
* [#14922](https://github.com/cosmos/cosmos-sdk/issues/14922) check for negative precision
46+
47+
### Testing
48+
49+
* [#15215](https://github.com/cosmos/cosmos-sdk/issues/15215) fix `FormatDec` test
50+
51+
## [math/v1.0.0-beta.6](https://github.com/cosmos/cosmos-sdk/releases/tag/math/v1.0.0-beta.6) - 2023-02-06
52+
53+
### Features
54+
55+
* [#14760](https://github.com/cosmos/cosmos-sdk/issues/14760) add collections key encoders and value encoders for common types.
56+
* [#14166](https://github.com/cosmos/cosmos-sdk/issues/14166) math: add generics versions of Max, Min to cater to all numeric types
57+
* [#13381](https://github.com/cosmos/cosmos-sdk/issues/13381) add uint `IsNil` method
58+
59+
### Improvements
60+
61+
* [#14010](https://github.com/cosmos/cosmos-sdk/issues/14010) math: optimize and test FormatInt + simplify LegacyNewDecFromStr
62+
* [#12794](https://github.com/cosmos/cosmos-sdk/issues/12794) math: precompute & use square of precisionReuse instead of 2 repeated computations
63+
64+
### Bug Fixes
65+
66+
* [#14691](https://github.com/cosmos/cosmos-sdk/issues/14691) do not flatten events attributes by event types
67+
* [#14252](https://github.com/cosmos/cosmos-sdk/issues/14252) math: add LegacyNewDecFromStr fuzzers + remove unnecessary error wrapping
68+
69+
### Testing
70+
71+
* [#14576](https://github.com/cosmos/cosmos-sdk/issues/14576) Added test cases for precisionMultiplier
72+
73+
## [math/v1.0.0-beta.3](https://github.com/cosmos/cosmos-sdk/releases/tag/math/v1.0.0-beta.3) - 2022-07-20
74+
75+
### Bug Fixes
76+
77+
* [#11996](https://github.com/cosmos/cosmos-sdk/issues/11996) math: fix Uint.Unmarshal's lack of negative value checking
3378

34-
* [#14010](https://github.com/cosmos/cosmos-sdk/pull/14010) Optimize FormatInt to not do plain string concentation when formatting thousands and instead build it more efficiently.
35-
* [#13381](https://github.com/cosmos/cosmos-sdk/pull/13381) Add uint `IsNil` method.
36-
* [#12634](https://github.com/cosmos/cosmos-sdk/pull/12634) Move `sdk.Dec` to math package, call it `LegacyDec`.
37-
* [#14166](https://github.com/cosmos/cosmos-sdk/pull/14166) Add generics versions of Max and Min, catering to all numeric types and allow for variadic calls, replacing the prior typed and strenuous code
38-
* [#15043](https://github.com/cosmos/cosmos-sdk/pull/15043) Add rand functions for testing purposes
79+
<!-- generated by git-cliff -->

scripts/update-swagger-ui-statik.sh

-2
This file was deleted.

0 commit comments

Comments
 (0)