Skip to content

[RKOTLIN-1115] Add support for switching user (#1816) #419

[RKOTLIN-1115] Add support for switching user (#1816)

[RKOTLIN-1115] Add support for switching user (#1816) #419

# This workflow is intended to keep certain branches in sync and will automatically create PR's between
# these branches. For now these PR's must be manually reviewed and merged. Consider if we should just
# automatically do this if there are no conflicts.
#
# This step will fail if a PR already exists, so we ignore failures. This also
# mean that if some other error occur, the error will also be swallowed. This is acceptable.
name: Auto merge change between branches
on:
push:
branches:
# List of "from" branches. Targets are defined by the `find-target-branch`-step below.
- releases
- main
jobs:
main:
name: Create PR with changes that should be merged into another branch
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v4
# Set the branch we want to merge changes into as step output. This step should list each branch name found in the `push`
# trigger in the top of this file.
- name: Set target branch
id: find-target-branch
shell: sh
run: |
if [ "${GITHUB_REF#refs/heads/}" = "releases" ]; then echo 'branch=${{ github.event.repository.default_branch }}' >> $GITHUB_OUTPUT; fi
# Unconditionally create a PR with the changes that needs to be manually reviewed.
# https://cli.github.com/manual/gh_pr_create
- name: Create Pull Request
id: open-pr
run: |
gh pr create \
--base '${{ steps.find-target-branch.outputs.branch }}' \
--head '${{ github.ref_name }}' \
--title "[Automated] Merge ${{ github.ref_name }} into ${{ steps.find-target-branch.outputs.branch }}" \
--body 'Automated Pull Request. Remember to choose "Create a merge commit" before merging.' \
|| true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}