My website is built on Jekyll and Github Pages. Jekyll allows you to assign a date of publication on a post but Github Pages won’t automatically push this post on that date for you. I have been wishing for ways to publish my editorial schedule without babysitting. I ran into a post which promised what I was looking for but it didn’t quite work for my requirements:
After some experimentation, I noticed the solution broke when I needed to schedule multiple posts in the future.
The blog post details you having to put your posts into one branch (
schedule) and then Zapier creates a PR and pushes it on a specific date indicated by your commit message.
Problem is, if you commit multiple posts ahead of time it pushes all your posts into master, not just the scheduled one. When the second date rolls around,
schedule has no changes. When a PR has no changes, Git won’t merge it.
To get around this, you could make an empty commit to
schedule on the date of publication. Unfortunately, there is no way to do this gracefully without running a server and writing a script.
After some serious frustrating spells, I managed to get this set up and working. To get scheduling, you’ll have to set up two zaps on Zapier.
To schedule a new post, work in a branch identified with the word Schedule and the date:
git checkout -b 'Schedule(10/27/2016)'
Unlike East 5th’s solution, which watches commits, using branches as a trigger helps avoid any errors created by watching commits. Adjustments can be made up until the date of publication and it won’t matter.
Set up the first Zapier to trigger when you create a new branch. Before you continue, ensure that you already have created a Branch on your repo named like this or the next step won’t display the named variable you’re looking for.
The next step is connecting to your Google calendar and creating a detailed event with the time and date of your post. I decided to create a new calendar to govern my editorial schedule but you can choose any calendar.
Summary field I put the word
Scheduled: and the
sha but this is only for my own identification. You can use whatever you want. In the
Description field, select the
Name of the branch (use the drop-down on the right for a full list of variables).
Start Date & Time and
End Date & Time fields, I chose
Name Schedule from the list of variables.
When testing this, you should see a calendar event appear at midnight on the date identified by your branch name.
If you post only on a day of the week, you can alter this to whatever timeframe you like.
Next search your calendar for Events with a description that matches today’s date. This matches the value of your Branch name.
If the previous step isn’t true the Zapier still continues. To stop this if it didn’t find an event, we have to update the event in the previous step and add a value to check agianst. I store the words
Go ahead in the
Add a filter to stop the process if your
Location doesn’t have the words
Last step is to create a pull request which looks for that specific
head name and only merges if it matches the
Event Description in Step 2.
If you don’t add the Boolean check, your PR will merge if it detects any event regardless of whether or not it matches today’s date.
There are a couple of things I’m still a little wary about with this approach:
Disclaimer: Testing this is a pain in the ass and trusting it is a whole different story altogether. Proceed with caution and please test on your own.
If you’re reading this post, it works. Sick. I have scheduled my last three posts on specific dates while I was away in Utah and California. If you have suggestions on how I can better optimize this flow, give me a heads up.
Thanks to the Peter Corey for starting this and Larry Marbuger for guiding me in the right direction.
Out of all the advice I give I tend to give this one the most often. It’s old-school advice drilled...
It’s the small things that make big waves. I have two habits I’ve picked up over the years which I...
The biggest lessons I’ve ever learned were from periods of extended commitment. Our available choices now send us into paralysis...
Asking for solutions first is bad management advice. ‘Don’t bring me problems—bring me solutions!’ teaches your team not to speak...