fix: changelog automation update #22
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: Infralovers Changelog Automation | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_call: | |
jobs: | |
prebuild: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.semrel.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check pre-commit presence | |
id: precommit_exists | |
uses: andstor/file-existence-action@v1 | |
with: | |
files: ".pre-commit-config.yaml" | |
- uses: actions/setup-python@v3 | |
if: steps.precommit_exists.outputs.files_exists == 'true' | |
- uses: pre-commit/[email protected] | |
if: steps.precommit_exists.outputs.files_exists == 'true' | |
- uses: go-semantic-release/action@v1 | |
if: github.event_name != 'pull_request' | |
id: semrel | |
with: | |
github-token: ${{ secrets.BOT_ACCESS_TOKEN }} | |
prepend: true | |
dry: true | |
release: | |
needs: [ prebuild ] | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.BOT_ACCESS_TOKEN }} # needed for push to protected branch | |
- uses: go-semantic-release/action@v1 | |
if: needs.prebuild.outputs.version != '' | |
id: generate_changelog | |
with: | |
github-token: ${{ secrets.BOT_ACCESS_TOKEN }} | |
prepend: true | |
changelog-file: CHANGELOG.md | |
- name: Update changelog | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
if: steps.generate_changelog.outputs.version != '' | |
with: | |
commit_user_name: infralovers-machine | |
commit_user_email: [email protected] | |
commit_message: 'chore(ci): commit changes from go-semantic-release' | |
file_pattern: CHANGELOG.md |