This repository was archived by the owner on Aug 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
chore: Generate clog from template #200
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
018fb2e
chore: Generate changelog from template
greyscaled 4180585
fixup! chore: Generate changelog from template
greyscaled 4daca01
Too much arugula
greyscaled deb7085
Use Function
greyscaled bdb8950
fixup! Use Function
greyscaled 61e62cb
Dont use {}
greyscaled 83d7719
Use getopt
greyscaled 9ea0241
fixup! Use getopt
greyscaled c0d42e8
fixup! Use getopt
greyscaled File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # create-clog.sh [--version=<version>] [--release-date=<release-date>] | ||
| # | ||
| # Dependencies: getopt sed | ||
| # | ||
| # Description: Uses template_changelog.md to create a new changelog. | ||
| # | ||
| # Examples: | ||
| # ./scripts/create-clog.sh --version="1.18.0" --release-date="05/18/2021" | ||
|
|
||
|
|
||
| set -eou pipefail | ||
|
|
||
| VERSION_DELIM="<% X.Y.Z %>" | ||
| RELEASE_DATE_DELIM="<% MM/DD/YYYY %>" | ||
| VERSION="" | ||
| RELEASE_DATE="" | ||
|
|
||
| # usage prints information for how to use this program. Exits with status code | ||
| # 1. | ||
| function usage () { | ||
| echo "Usage: create-clog [--version=<version>] [--release-date=<release-date>]" | ||
| echo "Create a changelog from a template" | ||
| echo "Arguments:" | ||
| echo " <version>: A version string 'x.y.z'" | ||
| echo " <release-date>: A date string 'mm/dd/yyyy'" | ||
| exit 1 | ||
| } | ||
|
|
||
| # init parses arguments and initializes all variables. | ||
| function init () { | ||
| options=$(getopt \ | ||
| --name="$(basename "$0")" \ | ||
| --longoptions=" \ | ||
| help, \ | ||
| release-date:, \ | ||
| version:" \ | ||
| --options="h" \ | ||
| -- "$@") | ||
| [ $? -eq 0 ] || { | ||
| usage | ||
| } | ||
|
|
||
| eval set -- "$options" | ||
|
|
||
| while true; do | ||
| case "${1:-}" in | ||
| -h|--help) | ||
| usage | ||
| ;; | ||
| --version) | ||
| shift; | ||
| VERSION="$1" | ||
| ;; | ||
| --release-date) | ||
| shift; | ||
| RELEASE_DATE="$1" | ||
| ;; | ||
| --) | ||
| shift | ||
| break | ||
| ;; | ||
| esac | ||
| shift | ||
| done | ||
|
|
||
| if [ -z "$VERSION" ]; then | ||
| echo "version argument is empty." | ||
| echo "Expected a version string like 'x.y.z'" | ||
| usage | ||
| fi | ||
|
|
||
| if [ -z "$RELEASE_DATE" ]; then | ||
| echo "release-date argument is empty." | ||
| echo "Expected a date string like 'mm/dd/yyyy'" | ||
| usage | ||
| fi | ||
| } | ||
|
|
||
| # create_from_template creates a new changelog file from template_changelog.md | ||
| # using VERSION and RELEASE_DATE. | ||
| function create_from_template () { | ||
| echo "Creating template using version: $VERSION and release date: $RELEASE_DATE" | ||
| pushd "$(git rev-parse --show-toplevel)" > /dev/null | ||
| clogPath="./changelog/$VERSION.md" | ||
| cp ./scripts/template_changelog.md "$clogPath" | ||
| sed -i "s|$VERSION_DELIM|$VERSION|g" "$clogPath" | ||
| sed -i "s|$RELEASE_DATE_DELIM|$RELEASE_DATE|g" "$clogPath" | ||
| popd > /dev/null | ||
| } | ||
|
|
||
| # main program | ||
| init "$@" | ||
| create_from_template | ||
| echo "Done" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| title: "<% X.Y.Z %>" | ||
| description: "Released on <% MM/DD/YYYY %>" | ||
| --- | ||
|
|
||
| ### Breaking Changes ❗ | ||
|
|
||
| There are no breaking changes in <% X.Y.Z %>. | ||
|
|
||
| ### Features ✨ | ||
|
|
||
| There are no new features in <% X.Y.Z %>. | ||
|
|
||
| ### Bug Fixes 🐛 | ||
|
|
||
| There are no bug fixes in <% X.Y.Z %>. | ||
|
|
||
| ### Security Updates 🔐 | ||
|
|
||
| There are no security updates in <% X.Y.Z %>. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I love the cutesy emojis btw
@khorne3 mentioned we should use sentence case for lower-level headings, so I think this would be "Breaking changes" ?
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.
If we do that, we should update all clogs. Happy for us to do that, though as a different changeset. I'm super glad we're increasing our consistency and standardizing these decisions!!!!! ❤️
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.
btw, and it pains me a bit to say this, because I love the emojis, but... the emojis result in slightly worse fragments:
https://coder.com/docs/changelog/1.17.0#breaking-changes-(note the trailing hyphen)I dunno if there's some way to customize this in the JavaScript we're using to transform the Markdown, though
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.
Worth investigating - CH story would be useful as that's the responsibility of
m, not anything incdr/docsAFAICT