Rework internal sync error handling (#1490) #267
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
# 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@v3 | |
# 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/}" = "main" ]; then echo '::set-output name=branch::releases/ktor2-support'; fi | |
if [ "${GITHUB_REF#refs/heads/}" = "releases" ]; then echo '::set-output name=branch::${{ github.event.repository.default_branch }}'; 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 }} |