I'm trying to get ahead on the Action Spotlight series, and needed a way to write and stage a post in advance of it's Friday publication date.
So, this week's post covers an action that I needed automatically merge the pull request containing this blog post -
Merge Schedule allows you to merge pull requests at a scheduled time. The most common use case that I’ve seen for this so far is to merge content into a static site (like this one) at some point in the future.
Scheduled pull requests allows you to stage and approve content ahead of time and have it automatically merged (and deployed if you have a pipeline set up) automatically.
There are two separate handlers in
merge-schedule-action. The first handles a
synchronize-d, and the second is run when triggered on a
It’s important to note that you cannot schedule merges from forks.
pull_request handler is a really useful addition to the action. Whenever a PR is opened it checks if the body contains a
/schedule command. If it does, a check is added using the
/scheduleis invalid, a
failurecheck is added to the PR to indicate that something is wrong, allowing the author to fix the date.
failurecheck is added to the PR (but will still be merged by the
in_progresscheck which prevents the PR being merged (unless you’re an admin)
This is where the bulk of the work happens. This method is triggered on a schedule that you set in your workflow. You can choose any schedule you like, but I’d recommend hourly (if you set specific publish times) or once per day (if you only set a publish date).