Fix Changelog Push Branch Target #10
Workflow file for this run
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: '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)' |