I have a blog which is generated from a directory of .md files. For the last 10 years I’ve been writing new posts in Emacs, but finding time to sit in front of my laptop is harder and harder nowadays. Some time ago I discovered Drafts and this week I understood how I can integrate it into my workflow.
I made two actions for this and wrote a post how I use them.
3 Likes
Great stuff! Thanks for sharing it. I’ve been hoping someone would post some examples of working directly with the GitHub APIs.
@agiletortoise I wonder if there is a better way for settings like repository name rather than just embedding this in source code?..
There are a number of ways you could do it, depends on your needs whether it makes sense to implement them:
-
Use additional Credentials fields: Your script is already using a Credential object to store the API key. You could also store repo information in it with more
addTextField
calls.
-
Use define template tag steps: If you main concern is making it easier to configure the action, this is useful. Example of doing this is in my Airtable.js Example action.
-
Store them in a file: You can store a JSON file in iCloud Drive and read it into the script. Not sure what this would gain you, but it’s an option.
If you are just worried about making it easier to configure, you might just add an additional script step that was first in the action and contained just the variable definitions. That makes it easier to direct another user to modify the action for their needs because they know they are save updating just those values.
And for template tag you’ll have to enter them every time, right? So in this case credential fields seem to be most convenient way I guess…
No, the template tags are just a handy way to layout each of the fields needed for a user who doesn’t want to edit a script.