Generate Changelog #14
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
| name: Generate Changelog | |
| permissions: | |
| contents: write # allow git push / branch creation | |
| pull-requests: write # allow creating/updating PRs | |
| issues: write # allow label creation | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version (e.g. 4.0.0-rc.1)' | |
| required: true | |
| jobs: | |
| changelog: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # auto-changelog sees full history | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '16' # the preferred LTS | |
| - name: Install auto-changelog | |
| run: npm install auto-changelog --no-save | |
| - name: Update version in package.json | |
| run: npm version ${{ github.event.inputs.version }} --no-git-tag-version | |
| - name: Generate CHANGELOG.md | |
| run: npm run version | |
| # assumes package.json has: | |
| # "scripts": { "version": "auto-changelog -p && git add CHANGELOG.md" } | |
| - name: Create Pull Request for changelog | |
| uses: peter-evans/create-pull-request@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # head branch to create: | |
| branch: changelog/${{ github.event.inputs.version }} | |
| base: main | |
| # changelog commit author | |
| author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" | |
| # only include these two files in the commit | |
| add-paths: | | |
| package.json | |
| CHANGELOG.md | |
| commit-message: "chore: update changelog for ${{ github.event.inputs.version }}" | |
| title: "chore: update changelog for ${{ github.event.inputs.version }}" | |
| body: | | |
| This PR was generated by GitHub Actions to update the CHANGELOG for release **${{ github.event.inputs.version }}**. | |
| labels: documentation |