Code Monkey home page Code Monkey logo

sync-branch-action's Introduction

Sync Branch Action

CI PR

An action to automate your branch update process. This action opens a pull request automatically for you whenever there are changes in a branch that you want to observe.

Features

  • Open a pull request whenever there are changes to a branch you want to observe.
  • Before opening a new pull request, check if there is already an open one with the same purpose. If so, a new pull request is not opened.
  • If a pull request is already open and there are changes to the observed branch, those changes are automatically included in the pull request already open.
  • If label is provided and doesn't exist in the repository, action creates missing label.

Inputs

Name Type Required Description
GITHUB_TOKEN String true User token to be associated with this pull request.
SOURCE_BRANCH String true Branch where you implemented your new code.
DESTINATION_BRANCH String true Branch you want to send your new code.
PULL_REQUEST_TITLE String false Standard title for your update pull request. Default is: "update: sync ${DESTINATION_BRANCH} with ${SOURCE_BRANCH}
PULL_REQUEST_BODY String false Content with description for your automated pull. Default is: "This is an automatic Pull Request to keep ${DESTINATION_BRANCH} up to date with ${SOURCE_BRANCH}! ๐Ÿ”„"
PULL_REQUEST_LABEL String false Label for your automated pull. Default is: ""

Outputs

Name Type Description
PULL_REQUEST_URL String The url of the generated pull request.

Usage example

Usage example for simple cases.

name: Update Branch

on:
  push:
    branches:
      - main

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Setup environment
        uses: actions/checkout@v2

      - name: Create update pull request
        uses: LucasRuy/[email protected]
        with:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
          SOURCE_BRANCH: 'main'
          DESTINATION_BRANCH: 'develop'

Example of use with customized title, description and label.

name: Update Branch

on:
  push:
    branches:
      - main

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Setup environment
        uses: actions/checkout@v2

      - name: Create update pull request
        uses: LucasRuy/[email protected]
        with:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
          SOURCE_BRANCH: 'main'
          DESTINATION_BRANCH: 'develop'
          PULL_REQUEST_TITLE: 'sync: keep branch develop updated'
          PULL_REQUEST_BODY: 'Custom body of my auto update pull request.'
          PULL_REQUEST_LABEL: 'ci'

Next steps [to-do]

New possible features for this action. Ideas are welcome.

  • Include the possibility of including in the description of the automatic PR, which branches or PR's merged into the observed branch.
  • Support for multiple labels

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.