From 426015bb33d878cb00b05cd7f0ecb9496bfa8c34 Mon Sep 17 00:00:00 2001 From: Hoang Do Date: Thu, 9 May 2024 16:12:06 +0700 Subject: [PATCH] Feat(ci): Auto changelog (#831) Co-authored-by: github-actions --- .github/workflows/changelog.yml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 9141445ab..43ceca99a 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -21,21 +21,32 @@ jobs: - name: Generate Changelog Update run: | - # Example: Using conventional-changelog to update CHANGELOG.md npm install -g conventional-changelog-cli conventional-changelog -p angular -i CHANGELOG.md -s + - name: Check if "auto-changelog-update" branch exists and update if needed + id: check_branch + run: | + git fetch origin auto-changelog-update:auto-changelog-update --no-tags + if git rev-parse --verify --quiet auto-changelog-update; then + echo "::set-output name=branch_exists::true" + git checkout auto-changelog-update + git merge main --no-edit + else + echo "::set-output name=branch_exists::false" + git checkout -b auto-changelog-update + fi + - 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 }} + title: "Automated Changelog Update" + body: "Update the CHANGELOG.md with recent pushes to branch main." + branch: "auto-changelog-update" # Static branch name delete-branch: true - branch-suffix: timestamp - + branch-suffix: none - name: Check if PR needs to be updated if: steps.cpr.outputs.pull-request-operation == 'updated' run: |