Add Github Action to automatically bump version at PR merge #1
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: Bump version on PR merge | |
on: | |
pull_request: | |
branches: | |
- main | |
types: closed | |
permissions: | |
contents: write | |
jobs: | |
update_version: | |
if: github.event.pull_request.merged == true | |
runs-on: macos-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
# Fetch full depth, otherwise the last step overwrites the last commit's parent, essentially removing the graph. | |
fetch-depth: 0 | |
- name: Run bump_version_gh_action.sh | |
run: | | |
bash ./bump_version_gh_action.sh | |
- name: Amend the last commit | |
run: | | |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git config --global user.name "${GITHUB_ACTOR}" | |
git commit -a --amend --no-edit | |
git push --force-with-lease | |
echo "Complete" |