🔖 Prepare latest release #29
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
name: changelog generation | |
# Only trigger on pull request closed events | |
on: | |
pull_request: | |
types: [closed] | |
jobs: | |
debug: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: hmarr/debug-action@v2 | |
changelog: | |
# This job will only run if a PR has been merged or a tag has been created | |
if: ${{ github.base_ref == 'v4/latest' && github.event.pull_request && github.event.pull_request.merged == true }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checking out repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: '0' | |
- name: Generating changelog | |
env: | |
BASE_REF: ${{ github.base_ref }} | |
run: | | |
# Get the originating branch | |
BRANCH=$(git branch -r --contains $BASE_REF | sed "s/^\s*origin\///") | |
git checkout $BRANCH | |
npm i | |
node bin/changelog | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "GitHub Actions Bot" | |
git add . | |
git commit -m ":memo: Add CHANGELOG" | |
git push --set-upstream origin $BRANCH |