Skip to content

Instantly share code, notes, and snippets.

@devvspaces
Created July 20, 2022 21:32
Show Gist options
  • Save devvspaces/cd9f6e4395615b0ac61a3b8b43fe1853 to your computer and use it in GitHub Desktop.
Save devvspaces/cd9f6e4395615b0ac61a3b8b43fe1853 to your computer and use it in GitHub Desktop.
What is github action all about?

This is an example of a github action that automatically merges master branch with production branch Use cases of this is wide:

  1. Example is automatically running test on your source code and if they passed, you can automatically build the file and push it to production, and then deploy the production branch on an online server

Learn more about github actions here

name: Update Production

on:
  push:
    branches:
      - master

permissions:
  # Need `contents: read` to checkout the repository
  # Need `contents: write` to merge branches
  contents: write

jobs:
  update-production:
    name: Merge master into production after a PR is merged
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0 # Let's get all the branches
      - name: Merge Master to Production branch
        uses: devvspaces/merge-branches@v1
        with:
          token: ${{ github.token }}
          from_branch: master
          to_branch: production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment