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' | |
env: | |
starting_branch: ${{ github.ref }} | |
working_branch: workflows/merge-release-changes-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@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: '${{ env.starting_branch }}' | |
- name: Create working branch | |
run: | | |
git checkout -b ${{ env.working_branch }} ${{ env.starting_branch }} | |
git pull ${{ env.working_branch }} | |
git push --set-upstream origin ${{ env.working_branch }} | |
# - name: Check for differences between release and main | |
# run: | | |
# git fetch origin ${{ env.base_branch }} | |
# DIFF=$(git log origin/${{ env.base_branch }}..${{ env.working_branch }}) | |
# if [ -z "$DIFF" ]; then | |
# echo "No differences found. Exiting without creating a pull request." | |
# exit 0 | |
# fi | |
- name: Create a pull request | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
delete-branch: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: 'Merge release 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 }}' |