A GitHub Action that extracts and formats changelog information from Rush.js projects. This action reads a specific version's changelog from a project's CHANGELOG.json
file and converts it into readable Markdown format.
- π Project Discovery: Automatically finds projects in Rush monorepos using
rush.json
- π Changelog Extraction: Reads
CHANGELOG.json
files from project folders - β‘ Version-Specific: Gets changelog for a specific version
- π Markdown Output: Converts JSON changelog to readable Markdown format
- π·οΈ Conventional Commits: Supports conventional commit formatting with emojis
- π Error Handling: Comprehensive error handling for missing files/versions
name: Get Changelog
on:
workflow_dispatch:
inputs:
project-name:
description: 'Project name to get changelog for'
required: true
default: '@your-org/your-project'
version:
description: 'Version to get changelog for'
required: true
default: '1.0.0'
jobs:
get-changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Changelog
id: changelog
uses: advancedcsg-open/actions-rush-get-changelog@v1
with:
project-name: ${{ inputs.project-name }}
version: ${{ inputs.version }}
- name: Display Changelog
run: |
echo "Changelog for ${{ inputs.project-name }} v${{ inputs.version }}:"
echo "${{ steps.changelog.outputs.markdown }}"
name: Create Release with Changelog
on:
push:
tags:
- 'v*'
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Extract project name from tag
id: project
run: |
# Assuming tag format like "project-name-v1.0.0"
project=$(echo "${GITHUB_REF#refs/tags/}" | sed 's/-v[0-9].*//')
echo "name=@your-org/$project" >> $GITHUB_OUTPUT
- name: Get Changelog
id: changelog
uses: advancedcsg-open/actions-rush-get-changelog@v1
with:
project-name: ${{ steps.project.outputs.name }}
version: ${{ steps.version.outputs.version }}
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.project.outputs.name }} v${{ steps.version.outputs.version }}
body: ${{ steps.changelog.outputs.markdown }}
draft: false
prerelease: false
Input | Description | Required | Default |
---|---|---|---|
project-name |
The name of the project to retrieve changelog for (must match packageName in rush.json ) |
β | - |
version |
The version of the changelog to retrieve | β | - |
Output | Description |
---|---|
markdown |
Markdown formatted changelog for the specified version and project |
The action reads the rush.json
file in the repository root to find the project configuration:
{
"projects": [
{
"packageName": "@your-org/your-project",
"projectFolder": "packages/your-project"
}
]
}
Once the project folder is identified, the action reads the CHANGELOG.json
file:
{
"name": "@your-org/your-project",
"entries": [
{
"version": "1.0.0",
"tag": "@your-org/your-project_v1.0.0",
"date": "Wed, 08 Dec 2021 08:44:31 GMT",
"comments": {
"patch": [
{ "comment": "fix: Fixed critical bug in authentication" }
],
"minor": [
{ "comment": "feat: Added new user dashboard" }
]
}
}
]
}
The JSON changelog is converted to formatted Markdown:
# @your-org/your-project v1.0.0
*Released: Wed, 08 Dec 2021 08:44:31 GMT*
## π Feat
- Added new user dashboard
## π Fix
- Fixed critical bug in authentication
The action recognizes conventional commit types and formats them with appropriate emojis:
Type | Emoji | Description |
---|---|---|
feat |
π | New features |
fix |
π | Bug fixes |
docs |
π | Documentation changes |
style |
π | Code style changes |
refactor |
π¨ | Code refactoring |
perf |
β‘ | Performance improvements |
test |
β | Test additions/changes |
chore |
π§ | Maintenance tasks |
revert |
π | Reverted changes |
other |
π | Other changes |
The action provides clear error messages for common issues:
- Project not found: When
project-name
doesn't exist inrush.json
- Version not found: When the specified version doesn't exist in the changelog
- Missing files: When
rush.json
orCHANGELOG.json
files are missing - Invalid JSON: When JSON files are malformed
Your Rush.js repository should have:
your-repo/
βββ rush.json # Rush configuration
βββ packages/
βββ your-project/
βββ package.json
βββ CHANGELOG.json # Generated by Rush
Ensure your rush.json
includes the project:
{
"projects": [
{
"packageName": "@your-org/your-project",
"projectFolder": "packages/your-project"
}
]
}
The CHANGELOG.json
files are typically generated by Rush's change management system:
# Create change files
rush change
# Publish and generate changelogs
rush publish
npm test
npm run build
node demo.js
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
MIT License - see LICENSE file for details.
- Rush.js - The build orchestrator for JavaScript monorepos
- Rush Change Management - Documentation on Rush's changelog system