From b741dcd1ff9033df7016ad8068bdcdc515792284 Mon Sep 17 00:00:00 2001 From: Subeom Choi Date: Thu, 27 Jun 2024 12:44:21 +0900 Subject: [PATCH] feature: add unreleased to changelog if necessary --- .github/workflows/gitflow.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/gitflow.yml b/.github/workflows/gitflow.yml index 2d8de92..cd494c5 100644 --- a/.github/workflows/gitflow.yml +++ b/.github/workflows/gitflow.yml @@ -187,6 +187,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: + ref: ${{ env.SOURCE_BRANCH }} token: ${{ env.TOKEN }} - name: Checkout commit @@ -203,6 +204,14 @@ jobs: run: | cat ${{ env.CHANGELOG }} \ | grep '^${{ env.VERSION_HEADER }}Unreleased$' \ + || ( \ + echo "$(echo '${{ env.VERSION_HEADER }}Unreleased\n' | cat - ${{ env.CHANGELOG }})" > ${{ env.CHANGELOG }}; \ + git config user.name github-actions; \ + git config user.email github-actions@github.com; \ + git add ${{ env.CHANGELOG }}; \ + git commit -m "document: add Unreleased to ${{ env.CHANGELOG }}"; \ + git push; \ + ) \ || (echo 'failure=changelog-not-contains-unreleased' >> $GITHUB_OUTPUT; exit 1) git diff --name-only ${{ env.DESTINATION_COMMIT }} \ | grep --perl-regexp 'changelog\.md' \