Skip to content
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

Feature: github releases from changelog.md #669

Merged
merged 84 commits into from
Apr 4, 2023

Conversation

LeeWannacott
Copy link
Contributor

@LeeWannacott LeeWannacott commented Mar 16, 2022

This Pull Request creates a file in dist/update-release-notes.go that takes releases from a CHANGELOG.md based on the https://keepachangelog.com/en/1.1.0/ specification and pushes them to GitHub under Releases:

image

Help: go run update-release-notes.go --help

Example of use: go run update-release-notes.go -Repo=quick-lint/quick-lint-js -TagsRepo=quick-lint/quick-lint-js -AuthToken=$(cat token.txt)

I ran it on my fork; Here is the result: https://github.com/LeeWannacott/quick-lint-js/releases


ChatGPT's description: This is a Go (Golang) program that automates the release notes update process for a GitHub repository. The program is intended to be run periodically and automates the process of creating releases and updating release notes by extracting data from a changelog file and comparing it with the repository’s tags and releases.

The program is composed of several functions that work together to complete the following tasks:

Parse command line flags.
Get the path to the changelog file.
Extract data from the changelog file.
Get the tags from the GitHub repository.
Validate that all tags in the changelog have corresponding releases in the repository.
Update releases with changed release notes.
Create missing releases.
The program uses the GitHub API to interact with the repository and create or update releases. It also uses Go concurrency features to speed up the process of creating and updating releases.

@strager
Copy link
Collaborator

strager commented Mar 16, 2022

Is it possible to make the timestamps match the dates for historical releases? It currently says "3 hours ago" for each release.

Is this script idempotent? If I run the script multiple times, will it create duplicate releases or will it do nothing?

@LeeWannacott
Copy link
Contributor Author

LeeWannacott commented Mar 16, 2022

Is this script idempotent? If I run the script multiple times, will it create duplicate releases or will it do nothing?

Yes it is idempotent; HTTP put PATCH requests may be made to the API to update a release: https://docs.github.com/en/rest/reference/releases#update-a-release

Is it possible to make the timestamps match the dates for historical releases? It currently says "3 hours ago" for each release.

I don't know 🤷 the API doesn't seem to provide such an option:
https://docs.github.com/en/rest/reference/releases#create-a-release

Maybe if we give it the target_commitish from when the tag was put on it?; I don't know if that fixes the timestamp. 💭

Edit: It doesn't fix the timestamp; the releases API just uses the tag name to get the SHA for target_commitish anyway so it is somewhat redundant giving it. I don't think you can change the timestamp not with the API anyway.

https://stackoverflow.com/questions/47141323/how-can-i-edit-a-github-release-date

docs/quick-release-notes/main.go Outdated Show resolved Hide resolved
docs/quick-release-notes/main.go Outdated Show resolved Hide resolved
docs/quick-release-notes/main.go Outdated Show resolved Hide resolved
docs/quick-release-notes/main.go Outdated Show resolved Hide resolved
docs/quick-release-notes/main.go Outdated Show resolved Hide resolved
docs/quick-release-notes/main.go Outdated Show resolved Hide resolved
docs/quick-release-notes/main.go Outdated Show resolved Hide resolved
docs/quick-release-notes/main.go Outdated Show resolved Hide resolved
docs/quick-release-notes/main.go Outdated Show resolved Hide resolved
docs/quick-release-notes/main.go Outdated Show resolved Hide resolved
@LeeWannacott LeeWannacott marked this pull request as draft March 18, 2022 08:30
@LeeWannacott LeeWannacott marked this pull request as ready for review March 28, 2022 21:38
@LeeWannacott
Copy link
Contributor Author

Fixed latest tag bug: LeeWannacott@b01f9ff

@LeeWannacott LeeWannacott marked this pull request as ready for review April 3, 2023 03:41
LeeWannacott added a commit to LeeWannacott/blazing-releases that referenced this pull request Apr 3, 2023
dist/update-release-notes.go Outdated Show resolved Hide resolved
dist/update-release-notes.go Outdated Show resolved Hide resolved
dist/update-release-notes.go Outdated Show resolved Hide resolved
dist/update-release-notes.go Outdated Show resolved Hide resolved
dist/update-release-notes.go Outdated Show resolved Hide resolved
dist/update-release-notes.go Outdated Show resolved Hide resolved
dist/update-release-notes.go Outdated Show resolved Hide resolved
dist/update-release-notes.go Outdated Show resolved Hide resolved
dist/update-release-notes.go Outdated Show resolved Hide resolved
dist/update-release-notes.go Outdated Show resolved Hide resolved
LeeWannacott added a commit to LeeWannacott/blazing-releases that referenced this pull request Apr 4, 2023
@LeeWannacott LeeWannacott changed the title Feature: quick-release-notes. Feature: automate release notes from changelog. Apr 4, 2023
@LeeWannacott LeeWannacott changed the title Feature: automate release notes from changelog. Feature: github releases from changelog. Apr 4, 2023
@LeeWannacott LeeWannacott changed the title Feature: github releases from changelog. Feature: github releases from changelog.md Apr 4, 2023
@strager strager merged commit 4471fda into quick-lint:master Apr 4, 2023
LeeWannacott added a commit to LeeWannacott/blazing-releases that referenced this pull request Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants