Skip to content

Commit 430529d

Browse files
feat(changelog): add workflow_dispatch dry-run for end-to-end testing
1 parent baa2244 commit 430529d

1 file changed

Lines changed: 32 additions & 3 deletions

File tree

.github/workflows/changelog.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,26 @@ name: AI Changelog Generator
33
# Triggers on every GitHub Release event — both pre-release (Artifactory) and
44
# full release (Maven Central) so CHANGELOG.md is always updated before the
55
# artifacts land in the registries.
6+
#
7+
# Can also be triggered manually via workflow_dispatch for end-to-end testing
8+
# before a real release. Set dry_run=true (default) to skip the git commit.
69
on:
710
release:
811
types: [prereleased, released]
12+
workflow_dispatch:
13+
inputs:
14+
tag:
15+
description: 'Release tag to generate changelog for (e.g. 1.8.0)'
16+
required: true
17+
default: '1.8.0'
18+
dry_run:
19+
description: 'Dry run — generate entry but do NOT commit to develop'
20+
required: false
21+
default: 'true'
22+
type: choice
23+
options:
24+
- 'true'
25+
- 'false'
926

1027
permissions:
1128
contents: write # needed to commit + push CHANGELOG.md to develop
@@ -47,13 +64,25 @@ jobs:
4764
env:
4865
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4966
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
50-
RELEASE_TAG: ${{ github.event.release.tag_name }}
67+
# Use manual input tag when triggered via workflow_dispatch, otherwise use the release tag
68+
RELEASE_TAG: ${{ github.event.inputs.tag || github.event.release.tag_name }}
5169
run: node .github/scripts/generate-changelog.js
5270

71+
# Always print the diff so dry-run results are visible in the Actions log
72+
- name: Show generated CHANGELOG diff
73+
run: |
74+
echo "──── CHANGELOG.md diff (what would be committed) ────"
75+
git diff CHANGELOG.md || echo "(no changes — version may already exist)"
76+
echo "─────────────────────────────────────────────────────"
77+
if [[ "${{ github.event.inputs.dry_run }}" == "true" ]]; then
78+
echo "ℹ️ DRY RUN — commit step is skipped. Review the diff above."
79+
fi
80+
5381
# Commit only if CHANGELOG.md was actually modified (idempotent).
54-
# `git pull --rebase` prevents conflicts with the concurrent version-bump
55-
# commit from the newrelease action running in the build workflow.
82+
# Skipped when dry_run=true (manual trigger default) so you can test
83+
# end-to-end without touching develop.
5684
- name: Commit and push CHANGELOG.md
85+
if: ${{ github.event.inputs.dry_run != 'true' }}
5786
run: |
5887
git config user.name 'github-actions[bot]'
5988
git config user.email 'github-actions[bot]@users.noreply.github.com'

0 commit comments

Comments
 (0)