From ca3ea38770afcd11e50570a835090c68a377157f Mon Sep 17 00:00:00 2001 From: gouki0123 Date: Thu, 26 Nov 2020 15:09:21 +0800 Subject: [PATCH] add auto changelog workflow --- .github/workflows/auto-changelog.yml | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/auto-changelog.yml diff --git a/.github/workflows/auto-changelog.yml b/.github/workflows/auto-changelog.yml new file mode 100644 index 0000000..2f830ed --- /dev/null +++ b/.github/workflows/auto-changelog.yml @@ -0,0 +1,55 @@ +name: ChangeLog + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/setup-node@v2-beta + with: + node-version: '12' + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Checkout Tool + uses: actions/checkout@v2 + with: + repository: konakonall/auto-changelog + path: 'auto-changelog' + - name: Build Tool + run: | + cd auto-changelog + npm install + npm link + + - name: Generate ChangeLog + env: # Or as an environment variable + TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + auto-changelog --token $TOKEN + - name: Cat ChangeLog + run: cat CHANGELOG.md + + - name: Commit files + env: + CI_USER: "gouki0123" + CI_EMAIL: "gouki0123@gmail.com" + run: | + git config --local user.email "$CI_EMAIL" + git config --local user.name "$CI_USER" + git add CHANGELOG.md && git commit -m 'Updated CHANGELOG.md' && echo "push=1" >> $GITHUB_ENV || echo "No changes to CHANGELOG.md" + + - name: Push changes + if: env.push == 1 + env: + CI_USER: "gouki0123" + CI_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git push "https://$CI_USER:$CI_TOKEN@github.com/$GITHUB_REPOSITORY.git" HEAD:master