-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat(ci): Auto changelog with PR title instead (#734)
Co-authored-by: github-actions <[email protected]>
- Loading branch information
1 parent
b004f7a
commit cd66dfd
Showing
3 changed files
with
33 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,44 +1,42 @@ | ||
# This workflow will add a changelog to the repository when a new commit is pushed to the main branch. | ||
# E.g., manually edit the commit message to align with conventional commit messages, such as: | ||
# feat(database): add new indexing capabilities | ||
# This update introduces advanced indexing options for handling complex queries more efficiently. | ||
|
||
name: Changelog Update | ||
name: Auto Changelog Update | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
types: [opened, synchronize, reopened] | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
update_changelog: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
|
||
- name: Install conventional-changelog-cli | ||
run: npm install -g conventional-changelog-cli | ||
node-version: '18' | ||
|
||
- name: Generate changelog diff | ||
- name: Generate Changelog Update | ||
run: | | ||
git fetch origin main:main | ||
conventional-changelog -p angular -i CHANGELOG.md -s -r 0 > changelog_diff.md | ||
echo "::set-output name=changelog::$(cat changelog_diff.md)" | ||
- name: Commit and push changelog update | ||
# Example: Using conventional-changelog to update CHANGELOG.md | ||
npm install -g conventional-changelog-cli | ||
conventional-changelog -p angular -i CHANGELOG.md -s | ||
- name: Create or Update Pull Request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
commit-message: "Update CHANGELOG.md [skip ci]" | ||
title: "Automated Changelog Update [skip ci]" | ||
body: "Update the CHANGELOG.md with recent pushs. [skip ci]" | ||
branch: auto-changelog-update-${{ github.run_number }} | ||
delete-branch: true | ||
branch-suffix: timestamp | ||
|
||
- name: Check if PR needs to be updated | ||
if: steps.cpr.outputs.pull-request-operation == 'updated' | ||
run: | | ||
git config user.name 'github-actions' | ||
git config user.email '[email protected]' | ||
git add CHANGELOG.md | ||
git commit -m "Update CHANGELOG.md" | ||
git push origin HEAD:refs/heads/${{ github.head_ref }} | ||
echo "Changelog PR updated due to new commit to main." |
This file contains 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 @@ | ||
CHANGELOG.md |
This file contains 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