Code Monkey home page Code Monkey logo

Comments (9)

JigarM avatar JigarM commented on June 19, 2024 1

@peter-evans Below changes works fine for me.

name: Create Pull Request
on:
  push:
  schedule:
    - cron: '0 8 * * MON'
jobs:
  createPullRequest:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          ref: master
      - name: Reset develop branch
        run: |
          git fetch origin develop:develop
          git reset --hard develop
      - name: Create Pull Request
        id: cpr
        uses: peter-evans/[email protected]
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: Merge `development` to `master`
          title: Merge develop to master
          body: |
            Auto-generated PR to make sure our master branch should have the latest code 
          labels: ready for review
          branch: develop-promotion
      - name: Check outputs
        run: |
          echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
          echo "Pull Request Number - ${{ steps.cpr.outputs.pr_number }}" 

Thanks for the help!!!!

from create-pull-request.

peter-evans avatar peter-evans commented on June 19, 2024

@JigarM You can do that, yes. Please see this example.

Here is what that pattern would look like for your workflow. It checks out master, resets to develop, and then creates a PR to merge into master. The PR branch is named master-promotion (you can rename it to whatever you want, but don't use an existing branch).

    steps:
      - uses: actions/checkout@v2
      - name: Reset promotion branch
        run: |
          git fetch origin develop:develop
          git reset --hard develop
      - name: Create Pull Request
        id: cpr
        uses: peter-evans/[email protected]
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: Merge development to master
          title: '[Example] Add report file'
          body: |
            Auto-generated PR to make sure our `master` branch should have the latest code 
          labels: ready for review
          assignees: JigarM
          reviewers: JigarM
          branch: master-promotion

from create-pull-request.

JigarM avatar JigarM commented on June 19, 2024

@peter-evans Thanks for the quick response. Let me try this way.
I did the mistake to set the PR branch name with existing branch. I hope it should work. Will update you here.

Thanks anyway.!!!

from create-pull-request.

JigarM avatar JigarM commented on June 19, 2024

@peter-evans One more thing I want to share. Github action can't trigger the workflow on schedule time. such as when I write this, nothing happens.

on:
  schedule:
    - cron: '0 8 * * MON'

But when I add push, the action triggered on push

on:
  push:
  schedule:
    - cron: '0 8 * * MON'

So, how we can schedule without "push" call?

from create-pull-request.

peter-evans avatar peter-evans commented on June 19, 2024

Maybe MON isn't an accepted way to set the cron schedule. Try using digits to set the day instead.

on:
  schedule:
    - cron: '0 8 * * 1'

from create-pull-request.

JigarM avatar JigarM commented on June 19, 2024

@peter-evans That's not an issue. Even I tried cron: "*/2 * * * *" but still its not working.
YML is not calling at every 2 minutes.

That's why I need to add push in the yml.

from create-pull-request.

JigarM avatar JigarM commented on June 19, 2024

Do I need to update the yml with PAT(Personal access token)?

from create-pull-request.

peter-evans avatar peter-evans commented on June 19, 2024

You can't schedule it every 2 minutes. The shortest is 5.

The shortest interval you can run scheduled workflows is once every 5 minutes.

https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule

Also, make sure the workflow is in the master (default) branch. It won't trigger otherwise.

Do I need to update the yml with PAT(Personal access token)?

No, this is not necessary for your use case.

from create-pull-request.

JigarM avatar JigarM commented on June 19, 2024

Got it!!!
@peter-evans Thanks for correcting me. Changes runs fine now.
Thanks for everything..

from create-pull-request.

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.