Push to protected branch from GitHub actions
name: changelog
on:
release:
types: [released]
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
jobs:
changelog:
runs-on: ubuntu-latest
steps:
- name: 🔍 GH_TOKEN
if: env.GH_TOKEN == ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV
- name: 🤘 checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: main
token: ${{ env.GH_TOKEN }}
- name: ⚙ changelog
uses: faberNovel/github-changelog-generator-action@master
with:
options: --token ${{ secrets.GITHUB_TOKEN }} --o changelog.md
- name: 🚀 changelog
run: |
git config --local user.name github-actions
git config --local user.email [email protected]
git add changelog.md
git commit -m "🖉 Update changelog with ${GITHUB_REF#refs/*/}"
git pushLast updated