Created
January 15, 2026 15:54
-
-
Save llimllib/85e17922ec27b4dd513d54d23cfeb1bc to your computer and use it in GitHub Desktop.
Claude Code session: auto-populate changelog and add shellcheck CI
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
| ▐▛███▜▌ Claude Code v2.1.7 | |
| ▝▜█████▛▘ Opus 4.5 · Claude Pro | |
| ▘▘ ▝▝ ~/code/mdriver/better-release | |
| ❯ I want the release script in tools/release.sh to use the commit messages | |
| from the log to populate changelog.md, not to ask me to do it manually | |
| ⏺ Read(tools/release.sh) | |
| ⎿ Read 62 lines | |
| ⏺ Let me also check the current CHANGELOG.md structure. | |
| ⏺ Read(CHANGELOG.md) | |
| ⎿ Read 173 lines | |
| ⏺ I'll modify the release script to automatically populate the changelog from commit messages since the last tag. | |
| ⏺ Update(tools/release.sh) | |
| ⎿ Added 26 lines, removed 8 lines | |
| 29 echo "New version: $NEW_VERSION" | |
| 30 echo "" | |
| 31 | |
| 32 - # Show current unreleased changes from CHANGELOG.md | |
| 33 - echo "=== Current Unreleased changes ===" | |
| 34 - sed -n '/## \[Unreleased\]/,/## \[/p' CHANGELOG.md | sed '$d' | |
| - | tail -n +2 | |
| 35 - echo "" | |
| 32 + # Get the latest tag | |
| 33 + LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || | |
| +echo "") | |
| 34 | |
| 35 - # Optionally open editor to update changelog | |
| 36 - read -rp "Edit CHANGELOG.md now? (y/N): " EDIT_CHANGELOG | |
| 37 - if [ "$EDIT_CHANGELOG" = "y" ] || [ "$EDIT_CHANGELOG" = "Y" | |
| -]; then | |
| 38 - ${EDITOR:-vi} CHANGELOG.md | |
| 35 + # Get commit messages since last tag (or all commits if no | |
| +tag exists) | |
| 36 + if [ -n "$LATEST_TAG" ]; then | |
| 37 + COMMITS=$(git log --pretty=format:"- %s" | |
| +"$LATEST_TAG"..HEAD --no-merges) | |
| 38 + else | |
| 39 + COMMITS=$(git log --pretty=format:"- %s" --no-merges) | |
| 40 fi | |
| 41 | |
| 42 + if [ -z "$COMMITS" ]; then | |
| 43 + echo "No new commits since $LATEST_TAG" | |
| 44 + exit 1 | |
| 45 + fi | |
| 46 + | |
| 47 + echo "=== Changes to be added to changelog ===" | |
| 48 + echo "$COMMITS" | |
| 49 + echo "" | |
| 50 + | |
| 51 + # Insert commits into CHANGELOG.md after the [Unreleased] | |
| +header | |
| 52 + # Create a temp file with the new content | |
| 53 + { | |
| 54 + sed -n '1,/^## \[Unreleased\]/p' CHANGELOG.md | |
| 55 + echo "" | |
| 56 + echo "$COMMITS" | |
| 57 + sed -n '/^## \[Unreleased\]/,${/^## \[Unreleased\]/d;p}' | |
| +CHANGELOG.md | |
| 58 + } > CHANGELOG.md.tmp | |
| 59 + mv CHANGELOG.md.tmp CHANGELOG.md | |
| 60 + | |
| 61 # Update CHANGELOG.md: add new version header and update | |
| comparison links | |
| 62 DATE=$(date +%Y-%m-%d) | |
| 63 sed -i.bak "s/^## \[Unreleased\]/## [Unreleased]\n\n## | |
| [$NEW_VERSION] - $DATE/" CHANGELOG.md | |
| ⏺ The script now automatically: | |
| 1. Gets the latest git tag | |
| 2. Extracts all commit messages since that tag (excluding merge commits) | |
| 3. Formats them as bullet points | |
| 4. Inserts them into the changelog under [Unreleased] | |
| No more manual editing prompt. The commits will be shown before they're added so you can see what's going into the changelog. | |
| ✻ Cogitated for 31s | |
| ❯ while we're at it, can you add a step to CI that verifies that shellcheck | |
| passes all shell files without error. Right now there's just the one but | |
| in the future there might be more | |
| ⏺ Search(pattern: ".github/workflows/*.yml") | |
| ⎿ Found 2 files (ctrl+o to expand) | |
| ⏺ Read(.github/workflows/ci.yml) | |
| ⎿ Read 28 lines | |
| ⏺ Update(.github/workflows/ci.yml) | |
| ⎿ Added 9 lines | |
| 25 | |
| 26 - name: Check formatting | |
| 27 run: cargo fmt -- --check | |
| 28 + | |
| 29 + shellcheck: | |
| 30 + name: Shellcheck | |
| 31 + runs-on: ubuntu-latest | |
| 32 + steps: | |
| 33 + - uses: actions/checkout@v4 | |
| 34 + | |
| 35 + - name: Run shellcheck | |
| 36 + run: find . -name '*.sh' -type f | xargs shellcheck | |
| ⏺ Let me verify the release script passes shellcheck locally. | |
| ⏺ Bash(shellcheck /Users/llimllib/code/mdriver/better-release/tools/release.sh) | |
| ⎿ (No content) | |
| ⏺ Shellcheck passes with no errors. | |
| Done. I made two changes: | |
| 1. tools/release.sh - Now automatically populates the changelog from commit messages since the last tag (no more manual editing prompt) | |
| 2. .github/workflows/ci.yml - Added a shellcheck job that finds and checks all .sh files in the repo | |
| ❯ actions/checkout is currently at v6 | |
| ⏺ Update(.github/workflows/ci.yml) | |
| ⎿ Added 1 line, removed 1 line | |
| 30 name: Shellcheck | |
| 31 runs-on: ubuntu-latest | |
| 32 steps: | |
| 33 - - uses: actions/checkout@v4 | |
| 33 + - uses: actions/checkout@v6 | |
| 34 | |
| 35 - name: Run shellcheck | |
| 36 run: find . -name '*.sh' -type f | xargs shellcheck | |
| ⏺ Fixed. I notice the test job also uses actions/checkout@v4 - want me to update that one too? | |
| ❯ yes | |
| ⏺ Update(.github/workflows/ci.yml) | |
| ⎿ Added 1 line, removed 1 line | |
| 14 matrix: | |
| 15 os: [ubuntu-latest, macos-latest] | |
| 16 steps: | |
| 17 - - uses: actions/checkout@v4 | |
| 17 + - uses: actions/checkout@v6 | |
| 18 - uses: dtolnay/rust-toolchain@stable | |
| 19 | |
| 20 - name: Run tests | |
| ⏺ Done. Let me also check the release workflow for any v4 references. | |
| ⏺ Bash(grep -n "checkout@v" | |
| /Users/llimllib/code/mdriver/better-release/.github/workflows/release.yml) | |
| ⎿ 23: - uses: actions/checkout@v4 | |
| 51: - uses: actions/checkout@v4 | |
| ⏺ There are also two actions/checkout@v4 in release.yml (lines 23 and 51). Want me to update those as well? | |
| ❯ yes | |
| ⏺ Update(.github/workflows/release.yml) | |
| ⎿ Added 2 lines, removed 2 lines | |
| 20 target: aarch64-apple-darwin | |
| 21 | |
| 22 steps: | |
| 23 - - uses: actions/checkout@v4 | |
| 23 + - uses: actions/checkout@v6 | |
| 24 - uses: dtolnay/rust-toolchain@stable | |
| 25 | |
| 26 - name: Install target | |
| ... | |
| 48 contents: write | |
| 49 id-token: write | |
| 50 steps: | |
| 51 - - uses: actions/checkout@v4 | |
| 51 + - uses: actions/checkout@v6 | |
| 52 - uses: dtolnay/rust-toolchain@stable | |
| 53 - uses: actions/download-artifact@v6 | |
| 54 | |
| ⏺ Done. Both occurrences updated to v6. | |
| ❯ commit your changes | |
| ⏺ Bash(git status) | |
| ⎿ On branch better-release | |
| Changes not staged for commit: | |
| (use "git add <file>..." to update what will be committed) | |
| … +6 lines (ctrl+o to expand) | |
| ⏺ Bash(git diff) | |
| ⎿ diff --git i/.github/workflows/ci.yml w/.github/workflows/ci.yml | |
| index cf0dd55..811dec1 100644 | |
| --- i/.github/workflows/ci.yml | |
| … +96 lines (ctrl+o to expand) | |
| ⏺ Bash(git log --oneline -5) | |
| ⎿ 63de41a fix: preserve image aspect ratio by letting Kitty calculate row | |
| count (#17) | |
| 0ccae1d fix: prevent image markdown from being broken by line wrapping | |
| … +5 lines (ctrl+o to expand) | |
| ⏺ Bash(git add .github/workflows/ci.yml .github/workflows/release.yml | |
| tools/release.sh && git commit -m "feat: auto-populate changelog and add | |
| shellcheck CI…) | |
| ⎿ [better-release b46406f] feat: auto-populate changelog and add shellche | |
| ck CI | |
| 3 files changed, 38 insertions(+), 11 deletions(-) | |
| ⏺ Bash(git status) | |
| ⎿ On branch better-release | |
| nothing to commit, working tree clean | |
| ⏺ Committed as b46406f. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment