Skip to content

jojomatik/sync-branch

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sync-branch

GitHub release (latest SemVer) GitHub Build and publish

Sync one branch to another

Usage

name: Update another branch on each release
release:
  types:
    - published

jobs:
  sync_release_to_v1:
    if: ${{ startsWith(github.ref, 'refs/tags/v1') && !contains(github.ref, 'beta') }}
    name: Sync branch `main` to other branches (fast-forward enabled)
    runs-on: ubuntu-latest
    steps:
      - name: Keep `v1` up to date with `main` (fast-forward enabled)
        uses: jojomatik/sync-branch@v2
        with:
          # The branch to sync from
          #   Optional
          #   Default: github.ref_name
          source: "main"
          # The branch to sync to
          #   Optional
          #   Default: `beta`
          target: "v1"
          # The strategy to use, if fast-forward is not possible (merge, rebase, force, 
          # fail).
          #   Optional
          #   Default: `merge`
          #   Possible values:
          #     - `merge`:  merge the source branch into the target branch
          #     - `rebase`: rebase the target branch onto the source branch
          #     - `force`:  force push the source branch to the target branch (overrides
          #                 any changes on the target branch)
          #     - `fail`:   pushes the source branch to the target branch, fails if the 
          #                 target branch contains changes that are not present in the 
          #                 source branch
          strategy: "merge"
          # The changes to accept, if strategy `merge` leads to merge conflicts
          #   Optional
          #   Default: `target`
          #   Possible values:
          #     - `target`: forces conflicts to be auto-resolved cleanly by favoring
          #                 the target version. All non-conflicting changes are reflected 
          #                 in the merge result.
          #     - `source`: forces conflicts to be auto-resolved cleanly by favoring
          #                 the source version. All non-conflicting changes are reflected 
          #                 in the merge result.
          #     - `false`:  `merge` fails if any merge conflicts occur.
          resolve_conflicts: "target"
          # The name to create merge commits with
          #   Required, if strategy `merge` is used
          git_committer_name: ${{ secrets.BOT_GIT_NAME }}
          # The email to create merge commits with
          #   Required, if strategy `merge` is used
          git_committer_email: ${{ secrets.BOT_GIT_EMAIL }}
          # The access token to push to the repository
          #   Optional
          #   Default: github.token
          github_token: ${{ secrets.GH_TOKEN }}

Licensing

This project is licensed under the MIT License (MIT). See also LICENSE.