Skip to content

Commit

Permalink
Feat(ci): fix changelog workflow (#64)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <[email protected]>
  • Loading branch information
hoangdv2429 and github-actions authored May 2, 2024
1 parent 15c563b commit af463b7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 18 deletions.
49 changes: 33 additions & 16 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,61 @@
# 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.

# Creating Pr with following name convention. Common types include feat (a new feature), fix (a bug fix), docs (documentation changes),
# style (formatting, missing semi colons, etc.), refactor (code refactoring), test (adding missing tests),
# chore (changes to the build process or auxiliary tools and libraries such as documentation generation)
# e.g: feat(ci): Add auto generate changelog workflow
name: Changelog Update

on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
types: [closed]

permissions: write-all

jobs:
update_changelog:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.merge_commit_sha }}

- name: Set up Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: "18"

- name: Install conventional-changelog-cli
run: npm install -g conventional-changelog-cli

- name: Generate changelog diff
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
- name: Configure Git
run: |
git config user.name 'github-actions'
git config user.email '[email protected]'
- name: Simulate commit for PR title
run: |
echo "${{ github.event.pull_request.title }}" > temp_message.txt
git commit --allow-empty -F temp_message.txt
- name: Generate changelog
run: |
conventional-changelog -p angular -i CHANGELOG.md -s -r 0
- name: Show git status and changelog contents
run: |
git status
echo "Changelog contents:"
cat CHANGELOG.md
- name: Revert temporary commit
run: git reset HEAD~

- name: Commit and push changelog update
run: |
git add CHANGELOG.md
git commit -m "Update CHANGELOG.md"
git push origin HEAD:refs/heads/${{ github.head_ref }}
git diff --staged --quiet || git commit -m "Update CHANGELOG.md based on PR #${{ github.event.pull_request.number }} title"
git push origin HEAD:refs/heads/main
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGELOG.md
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* **ci:** Add auto update changelog workflow ([#61](https://github.com/dymensionxyz/rollapp-wasm/issues/61)) ([ed9c6da](https://github.com/dymensionxyz/rollapp-wasm/commit/ed9c6da98f33a9842ae83007b46bc074f67d2152))


### Improvement
### Chore

* **be:** bumps `block-explorer-rpc-cosmos v1.0.2` & `wasm-block-explorer-rpc-cosmos v1.0.2` ([#42](https://github.com/dymensionxyz/rollapp-wasm/issues/42)) ([eab8283](https://github.com/dymensionxyz/rollapp-wasm/commit/eab82830f8ac5586cdc5d67f134fe52cda48f502))
* **be:** bumps `block-explorer-rpc-cosmos v1.0.3` & `wasm-block-explorer-rpc-cosmos v1.0.3` ([#45](https://github.com/dymensionxyz/rollapp-wasm/issues/45)) ([349bb7c](https://github.com/dymensionxyz/rollapp-wasm/commit/349bb7cf51b954aba087f951bdce02f914d32d6c))
* **be:** bumps `block-explorer-rpc-cosmos v1.1.2` & `wasm-block-explorer-rpc-cosmos v1.1.2` ([#55](https://github.com/dymensionxyz/rollapp-wasm/issues/55))
* **be:** bumps `block-explorer-rpc-cosmos v1.1.2` & `wasm-block-explorer-rpc-cosmos v1.1.2` ([#55](https://github.com/dymensionxyz/rollapp-wasm/issues/55))

0 comments on commit af463b7

Please sign in to comment.