Skip to content

Fix Changelog Push Branch Target #10

Fix Changelog Push Branch Target

Fix Changelog Push Branch Target #10

name: 'Update Changelog'
on:
pull_request:
types: [opened, synchronize]
release:
types: [published]
permissions:
contents: write
jobs:
pull-request-update-changelog:
if: github.event_name == 'pull_request'
name: "Update Changelog"
runs-on: ubuntu-latest
steps:
- name: 'Generate Token'
uses: actions/create-github-app-token@v1
id: token-generator
with:
app-id: ${{ secrets.TOKEN_GENERATOR_APP_ID }}
private-key: ${{ secrets.TOKEN_GENERATOR_PRIVATE_KEY }}
- name: 'Checkout Branch'
uses: actions/checkout@v4
with:
ref: master
fetch-depth: 0
token: ${{ steps.token-generator.outputs.token }}
- name: 'Initialize Environment'
uses: ./.github/actions/initialize-environment
- name: 'Generate Changelog'
run: |
make generate_changelog
- name: 'Push Changes'
uses: stefanzweifel/git-auto-commit-action@v5
id: auto-commit
with:
commit_message: 'Update Changelog (!automated)'
branch: master
- name: 'Update Tag'
if: steps.auto-commit.outputs.changes_detected == 'true'
run: |
git fetch —tags -f
git tag -f 1.0.0-pre-alpha.2 ${{ steps.auto-commit.outputs.commit_hash }}
git push origin 1.0.0-pre-alpha.2 --force
release-update-changelog:
if: github.event_name == 'release'
name: "Update Changelog (Release)"
runs-on: ubuntu-latest
steps:
- name: 'Generate Token'
uses: actions/create-github-app-token@v1
id: token-generator
with:
app-id: ${{ secrets.TOKEN_GENERATOR_APP_ID }}
private-key: ${{ secrets.TOKEN_GENERATOR_PRIVATE_KEY }}
- name: 'Checkout Branch'
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.token-generator.outputs.token }}
- name: 'Initialize Environment'
uses: ./.github/actions/initialize-environment
- name: 'Generate Changelog'
run: |
make generate_changelog
- name: 'Push Changes'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'Update Changelog (!automated)'