Giter Site home page Giter Site logo

Comments (2)

MiguelSavignano avatar MiguelSavignano commented on June 10, 2024

Hello, Github action set that env variable. default-environment-variables.

GITHUB_SHA: The commit SHA that triggered the workflow. For example, ffac537e6cbbf934b08745a378932722df287a53.

The correct use for "merge type: now" is filtering the branch name, following your example It should be like this:

staging->master

on:
  push:
    branches:
      - 'staging'
jobs:
  merge-branch:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: Sync
        uses: devmasx/[email protected]
        with:
          type: now
          target_branch: 'master'
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

master->develop

on:
  push:
    branches:
      - 'master'
jobs:
  merge-branch:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: Sync
        uses: devmasx/[email protected]
        with:
          type: now
          target_branch: 'develop'
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

Taking into account that we need to create 2 workflows files.

We can create an optional input, GITHUB_SHA or HEAD_TO_MERGE. But I'm not sure how it works if we try to sync multiple branches in the same workflow.

But the problem is If no filters are used, when finished workflow that will execute "merge staging->master", Github will trigger another workflow for the master branch. That means Github always triggers a workflow every time a branch has new changes.

I would really appreciate your help.

from merge-branch.

MiguelSavignano avatar MiguelSavignano commented on June 10, 2024

I just tried and I surprise, at the end of a merge Github doesn't trigger another workflow. 😆

Maybe that behavior only happens in the beta version of GithubActions or something change in the Github API, anyway right now I can add the new optional input in this PR #4.

Thanks! @Hatzelencio

from merge-branch.

Related Issues (20)

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.