Merge a single pull request on an exact date/time

Hello, I’m new to GitHub Actions. I’m looking for the best way to merge a single pull request on an exact date/time that I set up for that specific pull request (so not on a general cron schedule). Then, I would like a bot or GitHub Actions to merge that pull request for me.

I did find this GitHub Action, and I tested it out: https://github.com/marketplace/actions/merge-schedule. But it ended up just not working how I would expect, and I went to look for a different solution.

So instead I’ve found https://github.com/marketplace/actions/merge-pull-requests, which has more options, which I like, and I’ve fully tested it and it does work just how I’d expect.

I set this new GitHub Action up as running on a schedule, and here’s my workflow for my action: https://github.com/emma-sax4/emma-sax4.github.io/blob/6d1810b306b203ce20fcb1500df1c76fc2c5e643/.github/workflows/auto_merge_pull_requests.yml.

But every now and then, I have a pull request that I want to merge on a schedule that *doesn’t match* what’s currently in my default branch.

If I change the cron’s schedule in my pull request, will the action then run and execute on the newly defined schedule? As an example, my hope is that a pull request like this (https://github.com/emma-sax4/emma-sax4.github.io/pull/215/files) would trigger the GitHub Action to run at 22:40 UTC on Fridays, which would merge its own pull request.

Or do I need to change/add the schedule to my default branch first for the action to run at 22:40 UTC?

Or, perhaps there’s an even better way to do what I’m trying, or a new GitHub Action I haven’t thought of.

Thanks in advance.

@emma-sax4 ,

I noticed that there are some actions in the GitHub Marketplace can auto-merge the PR with specified lables. You can try to set two cron for the schedule event in the workflow,

for example,

schedule:
  - cron: '20 21 * * 5'
  - cron: '40 22 * * 5'

then set different jobs run on different crons to merge PRs with different labels,

jobs:
  job1:
    if: github.event.schedule == '20 21 * * 5'
. . .
steps:
Auto-merge PR with label-1

job2:
if: github.event.schedule == '40 22 * * 5'
. . .
steps:
Auto-merge PR with label-2

In addition, I also find an APP ( PR Scheduler ) from the marketplace, I think it should be available to your case.

The PR scheduler app actually worked like a charm! It was exactly what I wanted!

Thank you!