Update merge-release-changes-to-main.yml #35
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
on: | |
push: | |
branches: | |
- 'workflows/gh-action-merge-release-changes-into-main' | |
# replace with release/1.3.x after testing | |
env: | |
starting_branch: ${{ github.ref }} | |
working_branch: workflows/merge-release-changes-to-main | |
# set base branch to main | |
base_branch: main | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
jobs: | |
check_out: | |
runs-on: ubuntu-latest | |
if: ${{ github.repository }} == 'hemlholtz-analytics/heat' | |
steps: | |
# make sure that new branch is created from starting_branch | |
- name: Delete working branch if it already exists | |
run: git push --delete origin ${{ env.working_branch }} || true | |
- uses: actions/checkout@v4 | |
with: | |
ref: '${{ env.starting_branch }}' | |
- name: Create working branch | |
run: | | |
git fetch origin main:main | |
git checkout -b ${{ env.working_branch }} | |
git checkout main -- heat/core/version.py | |
git config --global user.name 'ClaudiaComito' | |
git config --global user.email '[email protected]@users.noreply.github.com' | |
git add heat/core/version.py | |
git commit -m "Update version.py from main branch" | |
- name: Commit and push working branch | |
run: | | |
git config --global user.name 'ClaudiaComito' | |
git config --global user.email '[email protected]@users.noreply.github.com' | |
git push -u origin ${{ env.working_branch }} | |
- name: Create a pull request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
delete-branch: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: 'Merge release branch changes to main' | |
title: 'Merge ${{ env.starting_branch }} changes to ${{ env.base_branch }}' | |
body: 'This PR merges changes from release branch to main branch' | |
branch: '${{ env.working_branch }}' | |
base: '${{ env.base_branch }}' |