-
Notifications
You must be signed in to change notification settings - Fork 365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added JSON-based changes to auto-generate the changelog. #918
Conversation
Currently this needs a CHANGELOG entry and it will need a script to automerge and delete the entries on creating a release, or at least auto-merge them in on a PR or something. But the basic logic is here. The diff between the 34a35,38
>
> ### Internal
>
> - #918 - use JSON-based files to autogenerate CHANGELOG.md Completed:
|
1a751d2
to
849d0f5
Compare
This action should be able to resolve our changelog check, btw. We also, if the draft is not used, need to delete every JSON file in |
could this handle the situations when there are multiple prs before release doing the same thing, i.e entries adjusting the same changelog entry? Don't want the changelog to be a per-pr changelog, for that we could just use autogenerated changelogs |
The way to modify the entries pre-release would be to just modify that JSON file I believe. I've also added it so a single PR can modify multiple different changes: you can pass an object or array. [
{
"description": "sample 1, sample 2",
"type": "added"
},
{
"description": "sample 3, sample 4",
"type": "added"
},
{
"description": "some internal stuff",
"issues": [662],
"type": "internal"
}
] Or {
"description": "use JSON-based files to autogenerate CHANGELOG.md",
"issues": [662],
"type": "internal"
} This will get merged to: ### Added
- #919 - sample 1, sample 2
- #919 - sample 3, sample 4
### Internal
- #919 - some internal stuff
- #918 - use JSON-based files to autogenerate CHANGELOG.md The entries are sorted by PR number, so they will automatically sort in descending order. To modify an entry prior to release, just modify the JSON entry. It handles any number of changes, and doesn't use the changes until release (when the pre-release hook is used). However, you can update the CHANGELOG at any time, and the draft is meant to all you to verify it's working properly. |
70f8e86
to
862fc45
Compare
Ok I've updated the Github Actions for the changelog check to:
This should do everything. How it works is quite simple:
This means there will never be conflicts: multiple PRs can have the same types (numerous added types, etc.), can have one or more types (see the example), and since they are merged into a vector and sorted by PR number, the result will always be in descending order and look nice. If you would like to verify this, rename the template files to
The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
The ./.github/actions/cargo-publish
action needs to be updated to generate the changelog on pre-release.
There's also an issue with pre-releases, should pre-releases delete the changeset files or not?
I think it's probably a good idea, in retrospect, not delete the |
I believe the only thing left is adding the You can test the parsing and generating of the CHANGELOG via And it checks that the output is reasonable, say, for here: However, |
This is great, however I feel like it should actually probably be part of its own binary/crate. Maybe something for https://github.com/crate-ci/ ? |
4f1cdba
to
b89a186
Compare
This now handles You can test it for yourself running |
This finally handles pre-releases correctly, and it will behave as follows: When using a pre-release, it will update If a release occurs, it will change the unreleased section from: ## [Unreleased] - ReleaseDate
### Internal
- #918 - use JSON-based files to autogenerate CHANGELOG.md to: ## [Unreleased] - ReleaseDate
## [v0.2.4] - 2022-07-10
### Internal
- #918 - use JSON-based files to autogenerate CHANGELOG.md |
looks good! There's something wrong with the behaviour though.
the |
I've changed from renaming those files to just deleting them. This is ready for review. The only additional thing I could think of would be supporting YAML and TOML as well, since we practically do that already, and already have all the dependencies. YAML might be nice, since it looks like: description: "sample description for a PR adding one CHANGELOG entry."
issues:
- 437
type: "fixed" And TOML would be: description = "sample description for a PR adding one CHANGELOG entry."
issues = [437]
type = "fixed" |
I think json is fine for this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
fix the trailing folder and we can start to use this!
Solves merge conflicts between changelogs, by using sorting and type-based merging for the changelog from a series of JSON files. This allows conflict-free generation of a changelog using JSON-based changes, stored in `.changes`. Each entry can be object or array-based: the array must contain objects, where each object is a different change. The entries are added to the changelog, in sorted order, and the validity of the changelog is verified. To ensure fidelity of the changelog changes, the `no changelog` flag or at least 1 change (either removed, or added/dified and almovidated) for a JSON file under `.changes` must occur. A `pre-release-hook` has been added so all these changes are automerged into the CHANGELOG prior to release.
bors r=Emilgardis |
Build succeeded: |
Solves merge conflicts between changelogs, by using sorting and type-based merging for the changelog from a series of JSON files.
Closes #662.