posts/make-new-post-via-github-pull-request #52
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
title: Create New Posts by Making Pull Requests
layout: post
comments: false
tags: about this site
This is a little easier than I thought it would be. So basically it generates a post from a pull request's body and commits it to
main
branch. I already have an action that reruns the site generator whenever something new appears inposts/
directory, so in effect I just need to write whatever I want to write in the PR's body, and pressSquash and merge
when I'm happy with it.More specifically there are 4 GitHub actions in action (no pun intended):
drafts/${PR_BRANCH_NAME}
.posts/
directory: when I'm good with the PR body and merge the PR, an action will pipe the body into the new file. The draft iteme will also be removed.posts/
, and if so generates the static site. The generator itself doesn't change much, the action nicely takes care of caching it so that it doesn't spend twenty minutes compiling hakyll.