Editorial Workflows

Publish Jekyll Post

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: Publish a Jekyll post to GitHub Pages. Not compatible with Octopress. File issues at https://github.com/maxjacobson/github-pages-editorial

Shared by: Max Jacobson

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Configure Access Token ?
Save access token variable ?
Variable Name
github_access_token
Value
Input
Abort if missing access token ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Warn user of their grave error ?
Title
Improper configuration
Message
You must generate a GitHub application-specific access token and enter it in the "Configure Access Token" step of the workflow. Want to go to the page on GitHub where you can do that?
Button 1
Take me there
Output Value
Button 2
(don't show)
Output Value
Button 3
(don't show)
Output Value
Show Cancel Button
ON
Visit GitHub's access token page ?
Open in
  • In-App Browser
  • Default App / Safari
URL
https://github.com/settings/tokens/new
Tab
  • Last-used Tab
  • New Tab
  • Tab with ID:
Unique identifier
Wait until Loaded
OFF
Reveal Browser Automatically
ON
Abort!!! ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If
Configure repo ?
Save github path variable ?
Variable Name
path_to_repo
Value
Input
Abort if improperly configured repo info ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
error!!!
Warn user of their grave error ?
Title
Improper configuration
Message
Stopping because your GitHub username or repo name are blank. Please provide them in the "Configure repo" step.
Button 1
OK
Output Value
Button 2
(don't show)
Output Value
Button 3
(don't show)
Output Value
Show Cancel Button
OFF
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If
Get Current File Name ?
Include Folder
OFF
Include Extension
ON
Save filename variable ?
Variable Name
filename
Value
Input
Prompt for path to file in repo ?
Title
File to create
Initial Text
_posts/Year: 2001-Month: 01-Day: 01-filename%cursor
  • Single Line
  • Multiple Lines
Keyboard Options:
Save repo file path variable ?
Variable Name
path_to_file
Value
Input
Request commit message from user ?
Title
Enter commit message
Initial Text
Create filename%cursor
  • Single Line
  • Multiple Lines
Keyboard Options:
Save commit message to variable ?
Variable Name
commit_message
Value
Input
Create the post on GitHub!!! ?
Source Code
#coding: utf-8
import workflow, requests, editor, base64, json

post = editor.get_text()
filename = workflow.get_variable('filename')
path_to_repo = workflow.get_variable('path_to_repo')
path_to_file = workflow.get_variable('path_to_file')
access_token = workflow.get_variable('github_access_token')

root = "https://api.github.com"
endpoint = "/repos/" + path_to_repo + "/contents/" + path_to_file

headers = {}
headers['Accept'] = 'application/vnd.github.v3+json'
headers['Authorization'] = "token " + access_token

params = {}
params['content'] = base64.b64encode(post)
params['message'] = workflow.get_variable('commit_message')

result = requests.put(root + endpoint, headers=headers, data=json.dumps(params))

output = "error!!!"

if result.status_code == 201:
	output = result.json()['content']['html_url']

workflow.set_output(output)
Check for error and apologize ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
error!!!
Show Alert ?
Title
Sorry...
Message
I thought that would work, but it didn't...
Button 1
OK
Output Value
Button 2
(don't show)
Output Value
Button 3
(don't show)
Output Value
Show Cancel Button
OFF
Abort!!! ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If
Celebrate success ?
Title
Success!
Message
The post was created on GitHub. Want to see it?
Button 1
OK
Output Value
Input
Button 2
(don't show)
Output Value
Button 3
(don't show)
Output Value
Show Cancel Button
ON
Open the newly-created file in the browser ?
Open in
  • In-App Browser
  • Default App / Safari
URL
Input
Tab
  • Last-used Tab
  • New Tab
  • Tab with ID:
Unique identifier
Wait until Loaded
OFF
Reveal Browser Automatically
ON