-
Notifications
You must be signed in to change notification settings - Fork 403
[feat] Automated API changelog generation #6215
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
Draft
snomiao
wants to merge
18
commits into
main
Choose a base branch
from
sno-api-changelog
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,372
−2
Draft
Changes from 7 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ff60bdf
[feat] Add automated API changelog generation workflow
snomiao 5cf6ac0
[automated] Apply ESLint and Prettier fixes
actions-user 608874a
Merge branch 'main' into sno-api-changelog
snomiao 0aab7cb
[feat] Configure API changelog workflow to run on push to sno-api-cha…
snomiao 8b88f8c
[fix] Preserve API changelog scripts when checking out previous version
snomiao c841445
[fix] Remove copied scripts before git checkout to avoid conflicts
snomiao 3742a76
[fix] Use current branch as PR base when triggered by push event
snomiao 1192270
Merge branch 'main' into sno-api-changelog
snomiao 75daf2e
[docs] Add API changelog generation demo
snomiao f1193a2
[fix] Exclude demo-snapshots from knip checks
snomiao 30dcf8c
[feat] Add manual dispatch workflow for API changelog generation
snomiao 95c815f
[docs] Add comprehensive documentation for manual API changelog workflow
snomiao 779f539
Merge branch 'main' into sno-api-changelog
snomiao 9c94a48
[feat] Remove Additions section and add hyperlinks to API changelog
snomiao cb32562
Merge branch 'main' into sno-api-changelog
snomiao e933b5c
[feat] Enable declarationMap for source file mapping in API changelog
snomiao 98ed124
[feat] Add source file location discovery to API snapshot tool
snomiao f844d3e
[feat] Use source file links instead of dist .d.ts in API changelog
snomiao 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,197 @@ | ||
| name: Release API Changelogs | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: ['Release NPM Types'] | ||
| types: | ||
| - completed | ||
| push: | ||
| branches: | ||
| - sno-api-changelog | ||
|
|
||
| concurrency: | ||
| group: release-api-changelogs-${{ github.workflow }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| generate_changelog: | ||
| name: Generate API Changelog | ||
| runs-on: ubuntu-latest | ||
| # Only run on successful completion of the Release NPM Types workflow or on push to sno-api-changelog | ||
| if: ${{ github.event_name == 'push' || github.event.workflow_run.conclusion == 'success' }} | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 # Fetch all history for comparing versions | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 10 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v5 | ||
| with: | ||
| node-version: 'lts/*' | ||
| cache: 'pnpm' | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
| env: | ||
| PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' | ||
|
|
||
| - name: Get current version | ||
| id: current_version | ||
| run: | | ||
| VERSION=$(node -p "require('./package.json').version") | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| echo "Current version: $VERSION" | ||
|
|
||
| - name: Get previous version | ||
| id: previous_version | ||
| run: | | ||
| # Get the two most recent version tags sorted | ||
| CURRENT_VERSION="${{ steps.current_version.outputs.version }}" | ||
| TAGS=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -2) | ||
|
|
||
| # Find the previous version tag (skip current if it exists) | ||
| PREVIOUS_TAG="" | ||
| for tag in $TAGS; do | ||
| TAG_VERSION=${tag#v} | ||
| if [ "$TAG_VERSION" != "$CURRENT_VERSION" ]; then | ||
| PREVIOUS_TAG=$tag | ||
| break | ||
| fi | ||
| done | ||
|
|
||
| if [ -z "$PREVIOUS_TAG" ]; then | ||
| echo "No previous version found, this may be the first release" | ||
| echo "version=" >> $GITHUB_OUTPUT | ||
| echo "tag=" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "version=${PREVIOUS_TAG#v}" >> $GITHUB_OUTPUT | ||
| echo "tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT | ||
| echo "Previous version: ${PREVIOUS_TAG#v}" | ||
| fi | ||
|
|
||
| - name: Build current types | ||
| run: pnpm build:types | ||
|
|
||
| - name: Snapshot current API | ||
| id: current_snapshot | ||
| run: | | ||
| # Create snapshots directory | ||
| mkdir -p .api-snapshots | ||
|
|
||
| # Generate snapshot of current types | ||
| node scripts/snapshot-api.js dist/index.d.ts > .api-snapshots/current.json | ||
|
|
||
| echo "Current API snapshot created" | ||
|
|
||
| - name: Preserve scripts for previous version | ||
| if: steps.previous_version.outputs.tag != '' | ||
| run: | | ||
| # Copy scripts to temporary location to use with previous version | ||
| mkdir -p /tmp/api-changelog-scripts | ||
| cp scripts/snapshot-api.js scripts/compare-api-snapshots.js /tmp/api-changelog-scripts/ | ||
|
|
||
| - name: Checkout previous version | ||
| if: steps.previous_version.outputs.tag != '' | ||
| run: | | ||
| # Stash current changes | ||
| git stash | ||
|
|
||
| # Checkout previous version | ||
| git checkout ${{ steps.previous_version.outputs.tag }} | ||
|
|
||
| # Restore scripts | ||
| mkdir -p scripts | ||
| cp /tmp/api-changelog-scripts/*.js scripts/ | ||
|
|
||
| - name: Build previous types | ||
| if: steps.previous_version.outputs.tag != '' | ||
| run: | | ||
| pnpm install --frozen-lockfile | ||
| pnpm build:types | ||
|
|
||
| - name: Snapshot previous API | ||
| if: steps.previous_version.outputs.tag != '' | ||
| run: | | ||
| # Generate snapshot of previous types | ||
| node scripts/snapshot-api.js dist/index.d.ts > .api-snapshots/previous.json | ||
|
|
||
| echo "Previous API snapshot created" | ||
|
|
||
| - name: Return to current version | ||
| if: steps.previous_version.outputs.tag != '' | ||
| run: | | ||
| # Remove copied scripts to avoid conflicts | ||
| rm -f scripts/snapshot-api.js scripts/compare-api-snapshots.js | ||
|
|
||
| git checkout - | ||
| git stash pop || true | ||
|
|
||
| - name: Compare API snapshots and generate changelog | ||
| id: generate_changelog | ||
| run: | | ||
| # Create docs directory if it doesn't exist | ||
| mkdir -p docs | ||
|
|
||
| # Run the comparison script | ||
| if [ -f .api-snapshots/previous.json ]; then | ||
| node scripts/compare-api-snapshots.js \ | ||
| .api-snapshots/previous.json \ | ||
| .api-snapshots/current.json \ | ||
| ${{ steps.previous_version.outputs.version }} \ | ||
| ${{ steps.current_version.outputs.version }} \ | ||
| >> docs/API-CHANGELOG.md | ||
| else | ||
| # First release - just document the initial API surface | ||
| echo "## v${{ steps.current_version.outputs.version }} ($(date +%Y-%m-%d))" >> docs/API-CHANGELOG.md | ||
| echo "" >> docs/API-CHANGELOG.md | ||
| echo "Initial API release." >> docs/API-CHANGELOG.md | ||
| echo "" >> docs/API-CHANGELOG.md | ||
| fi | ||
|
|
||
| # Check if there are any changes | ||
| if git diff --quiet docs/API-CHANGELOG.md; then | ||
| echo "has_changes=false" >> $GITHUB_OUTPUT | ||
| echo "No API changes detected" | ||
| else | ||
| echo "has_changes=true" >> $GITHUB_OUTPUT | ||
| echo "API changes detected" | ||
| fi | ||
|
|
||
| - name: Create Pull Request | ||
| if: steps.generate_changelog.outputs.has_changes == 'true' | ||
| uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e | ||
| with: | ||
| token: ${{ secrets.PR_GH_TOKEN }} | ||
| commit-message: '[docs] Update API changelog for v${{ steps.current_version.outputs.version }}' | ||
| title: '[docs] API Changelog for v${{ steps.current_version.outputs.version }}' | ||
| body: | | ||
| ## API Changelog Update | ||
|
|
||
| This PR documents public API changes between v${{ steps.previous_version.outputs.version }} and v${{ steps.current_version.outputs.version }}. | ||
|
|
||
| The changelog has been automatically generated by comparing TypeScript type definitions between versions. | ||
|
|
||
| ### Review Instructions | ||
| - Review the changes in `docs/API-CHANGELOG.md` | ||
| - Verify accuracy of breaking changes | ||
| - Add any additional context or migration notes if needed | ||
| - Merge when ready to publish changelog | ||
|
|
||
| --- | ||
| 🤖 Generated with [Claude Code](https://claude.com/claude-code) | ||
| branch: api-changelog-v${{ steps.current_version.outputs.version }} | ||
| base: ${{ github.event_name == 'push' && github.ref_name || 'main' }} | ||
| labels: documentation | ||
| delete-branch: true | ||
| draft: true | ||
| add-paths: | | ||
| docs/API-CHANGELOG.md | ||
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,27 @@ | ||
| # Public API Changelog | ||
|
|
||
| This changelog documents changes to the ComfyUI Frontend public API surface across versions. The public API surface includes types, interfaces, and objects used by third-party extensions and custom nodes. | ||
|
|
||
| **Important**: This is an automatically generated changelog based on TypeScript type definitions. Breaking changes are marked with ⚠️. | ||
|
|
||
| ## What is tracked | ||
|
|
||
| This changelog tracks changes to the following public API components exported from `@comfyorg/comfyui-frontend-types`: | ||
|
|
||
| - **Type Aliases**: Type definitions used by extensions | ||
| - **Interfaces**: Object shapes and contracts | ||
| - **Enums**: Enumerated values | ||
| - **Functions**: Public utility functions | ||
| - **Classes**: Exported classes and their public members | ||
| - **Constants**: Public constant values | ||
|
|
||
| ## Migration Guide | ||
|
|
||
| When breaking changes occur, refer to the specific version section below for: | ||
| - What changed | ||
| - Why it changed (if applicable) | ||
| - How to migrate your code | ||
|
|
||
| --- | ||
|
|
||
| <!-- Automated changelog entries will be added below --> |
Oops, something went wrong.
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.
remove before merge