<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Josh Campbell</title>
    <description>The latest articles on DEV Community by Josh Campbell (@seajoshc).</description>
    <link>https://dev.to/seajoshc</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F769060%2Fc25a4d9b-e037-485f-a75c-5d9471788777.jpeg</url>
      <title>DEV Community: Josh Campbell</title>
      <link>https://dev.to/seajoshc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/seajoshc"/>
    <language>en</language>
    <item>
      <title>Introducing Gistblog 🎉: Blog your little ❤️ out using GitHub Gists</title>
      <dc:creator>Josh Campbell</dc:creator>
      <pubDate>Tue, 07 Dec 2021 00:43:48 +0000</pubDate>
      <link>https://dev.to/seajoshc/introducing-gistblog-blog-your-little-out-using-github-gists-gkc</link>
      <guid>https://dev.to/seajoshc/introducing-gistblog-blog-your-little-out-using-github-gists-gkc</guid>
      <description>&lt;p&gt;Hey there and thanks for stopping by! For the the #ActionsHackathon21 I created something... that definitely belongs in the Whacky Wildcard category! I'd like to introduce you to...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/seajoshc/gistblog"&gt;Gistblog&lt;/a&gt; is an opinionated GitHub repo setup that turns markdown into blog posts. Powered by the &lt;a href="https://github.com/seajoshc/gistblog-action#readme"&gt;Gistblog GitHub Action&lt;/a&gt;, your markdown is turned into wonderful &lt;a href="https://gist.github.com/"&gt;GitHub Gists&lt;/a&gt; that can be easily updated and shared. &lt;a href="https://github.com/seajoshc"&gt;Here's my Gistblog&lt;/a&gt; embedded into my &lt;a href="https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/managing-your-profile-readme"&gt;GitHub profile README&lt;/a&gt;. The fancy markdown &lt;a href="https://gist.github.com/seajoshc/d898750deca042b9b241ad8b79bcac96"&gt;table of blog posts&lt;/a&gt; is even generated by the Gistblog Action too! Read on for more details about how you can start Gistblogging!&lt;/p&gt;

&lt;h3&gt;
  
  
  My Workflow
&lt;/h3&gt;

&lt;p&gt;Please see the official &lt;a href="https://github.com/seajoshc/gistblog#readme"&gt;Gistblog repository&lt;/a&gt; for the latest instructions on using Gistblog! tl;dr &lt;a href="https://github.com/seajoshc/gistblog/blob/main/.github/workflows/gistblog.yaml"&gt;This is the GitHub Actions workflow&lt;/a&gt; that does all the heavy lifting, and &lt;a href="https://github.com/seajoshc/gistblog-action"&gt;this is the GitHub Action&lt;/a&gt; I created to handle creating/updating the Gists.&lt;/p&gt;

&lt;h4&gt;
  
  
  Getting setup with Gistblog
&lt;/h4&gt;

&lt;p&gt;As I mentioned, Gistblog follows an opinionated setup in order to function. Please read the below carefully to get started.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new repo or use an existing repo. Create two directories in the root of your repo: a &lt;code&gt;blog/&lt;/code&gt; directory and a GitHub Actions workflow directory &lt;code&gt;.github/workflows/&lt;/code&gt; if it doesn't already exist.&lt;/li&gt;
&lt;li&gt;Create a new &lt;a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token"&gt;GitHub Personal Access Token&lt;/a&gt; with the &lt;code&gt;gist&lt;/code&gt; scope (name can be anything you want, like "Gistblog").&lt;/li&gt;
&lt;li&gt;Create a &lt;a href="https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository"&gt;repository secret&lt;/a&gt; named GISTS_TOKEN and store the value of the personal access token you just created.&lt;/li&gt;
&lt;li&gt;Create &lt;code&gt;.github/workflows/gistblog.yaml&lt;/code&gt; with the following GitHub Actions workflow. Be sure to change your branch name below if it isn't &lt;code&gt;main&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Gistblog&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;main&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;gistblog&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dorny/paths-filter@v2&lt;/span&gt;
        &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;blog&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;list-files&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;shell&lt;/span&gt;
          &lt;span class="na"&gt;filters&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;create_blog:&lt;/span&gt;
            &lt;span class="s"&gt;- added: 'blog/*.md'&lt;/span&gt;
            &lt;span class="s"&gt;update_blog:&lt;/span&gt;
            &lt;span class="s"&gt;- modified: 'blog/*.md'&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;steps.blog.outputs.create_blog == 'true'&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;seajoshc/gistblog-action@v1&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;gists-token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GISTS_TOKEN }}&lt;/span&gt;
          &lt;span class="na"&gt;operation&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;create&lt;/span&gt;
          &lt;span class="na"&gt;blog-files&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;steps.blog.outputs.create_blog_files&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;steps.blog.outputs.update_blog == 'true'&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;seajoshc/gistblog-action@v1&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;gists-token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GISTS_TOKEN }}&lt;/span&gt;
          &lt;span class="na"&gt;operation&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;update&lt;/span&gt;
          &lt;span class="na"&gt;blog-files&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;steps.blog.outputs.update_blog_files&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;In the spirit of the #ActionsHackathon21, you can see I'm taking advantage of the checkout action GitHub provides and the &lt;a href="https://github.com/dorny/paths-filter"&gt;Paths Filter action by dorny&lt;/a&gt; to create the desired workflow. I'm also using the &lt;a href="https://github.com/seajoshc/gistblog-action"&gt;Gistblog Action&lt;/a&gt; I created for this hackathon which handles managing all the blog posts as Gists. I'd like to explore &lt;a href="https://docs.github.com/en/actions/creating-actions/creating-a-composite-action"&gt;Composite actions&lt;/a&gt; soon to see if I can reduce all of this to a single action making setup even easier.&lt;/p&gt;
&lt;h4&gt;
  
  
  How to blog with Gistblog
&lt;/h4&gt;

&lt;p&gt;Gistblog simply looks for new, or updated, markdown (&lt;code&gt;.md&lt;/code&gt;) files in the &lt;code&gt;blog/&lt;/code&gt; directory of your repo each time you push to main. If there are new files, Gistblog will automatically create new Gists for your blog posts. And each time you update a file the Gist gets updated too. Each Gist/blog post is backed by a permanent link that you can share out. It's that easy!&lt;/p&gt;

&lt;p&gt;Ideally, you set a description for each blog post by declaring&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!--
post_description: Example Post Title: A short description goes here. 
--&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;at the top of each markdown file, &lt;a href="https://github.com/seajoshc/gistblog/blob/main/blog/example.md"&gt;like in this example&lt;/a&gt;. Link previews look a bit nicer when you use this description format.&lt;/p&gt;

&lt;p&gt;Gistblog also maintains a &lt;a href="https://gist.github.com/seajoshc/d898750deca042b9b241ad8b79bcac96"&gt;Table of Contents(ToC)&lt;/a&gt; for all your blog posts. The ToC gets updated each time Gistblog runs so it's always up to date. Check your &lt;a href="https://gist.github.com"&gt;Gists&lt;/a&gt; to find your ToC. Try putting the markdown table from your ToC into your &lt;a href="https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/managing-your-profile-readme"&gt;GitHub Profile README&lt;/a&gt; to &lt;a href="https://github.com/seajoshc"&gt;share your blog with the innerwebz&lt;/a&gt;. This is a manual process for now but I'll be looking to solve that in the future!&lt;/p&gt;

&lt;p&gt;If you've got assets, like images, create &lt;code&gt;blog/assets/&lt;/code&gt; and keep your files there. To include them in your post, you'll need to use the URL of where they will end up once pushed into your repo as the image source. The URL is predictable based on the file name and your GitHub username: &lt;code&gt;https://raw.githubusercontent.com/&amp;lt;github_username&amp;gt;/&amp;lt;repo_name&amp;gt;/main/blog/assets/&amp;lt;filename&amp;gt;.&amp;lt;extension&amp;gt;&lt;/code&gt;. &lt;a href="https://github.com/seajoshc/gistblog/blob/main/blog/example.md"&gt;See this example&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Changing the filenames on any Gists created by Gistblog will result in duplicate blog posts next time you update. It's best not to touch anything on the Gists really.&lt;/p&gt;

&lt;p&gt;Happy Gistblogging! 🎉&lt;/p&gt;
&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;Wacky Wildcards&lt;/p&gt;
&lt;h3&gt;
  
  
  Yaml File or Link to Code
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/seajoshc"&gt;
        seajoshc
      &lt;/a&gt; / &lt;a href="https://github.com/seajoshc/gistblog"&gt;
        gistblog
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Blog your little ❤️ out using GitHub Gists.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Gistblog - Blog your little ❤️ out using GitHub Gists.&lt;/h1&gt;
&lt;p&gt;Gistblog is an opinionated GitHub repo setup that turns markdown into blog posts. Powered by the &lt;a href="https://github.com/seajoshc/gistblog-action#readme"&gt;Gistblog GitHub Action&lt;/a&gt;, your markdown is turned into wonderful &lt;a href="https://gist.github.com/"&gt;GitHub Gists&lt;/a&gt; that can be easily updated and shared. &lt;a href="https://github.com/seajoshc"&gt;Here's my Gistblog&lt;/a&gt; embedded into my GitHub profile README. The fancy markdown &lt;a href="https://gist.github.com/seajoshc/d898750deca042b9b241ad8b79bcac96"&gt;table of blog posts&lt;/a&gt; is even generated by the Gistblog Action too!&lt;/p&gt;
&lt;p&gt;Do you need a simple platform for sharing your thoughts and ideas with the internet? Have you ever wanted an easy way to turn some plaintext into a blog post? Don't care about things like SEO, monetization, or having a fancy looking website? Is "indefinitely free" your desired monthly cost of hosting your own blog where all the content is yours? Already a big GitHub fan? &lt;a href="https://github.com/seajoshc/gistblog-action#readme"&gt;Gistblog&lt;/a&gt; is the blogging engine for you!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Because Gistblog is an opinionated framework, please read&lt;/strong&gt;…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/seajoshc/gistblog"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;




&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/seajoshc"&gt;
        seajoshc
      &lt;/a&gt; / &lt;a href="https://github.com/seajoshc/gistblog-action"&gt;
        gistblog-action
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Blog your little ❤️ out using GitHub Gists.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Gistblog Action&lt;/h1&gt;
&lt;p&gt;The Gistblog &lt;a href="https://github.com/features/actions"&gt;GitHub Action&lt;/a&gt; is &lt;a href="https://github.com/seajoshc/gistblog"&gt;part of an opinionated setup&lt;/a&gt; that lets you use GitHub Gists as a blogging engine. I strongly urge you to &lt;a href="https://github.com/seajoshc/gistblog#readme"&gt;read this first&lt;/a&gt;. You can also &lt;a href="https://gist.github.com/seajoshc/9a3ee57dd7f380b5d6ce2a17805013c8"&gt;checkout this blogpost&lt;/a&gt; for more info about Gistblog.&lt;/p&gt;
&lt;h2&gt;
Inputs&lt;/h2&gt;
&lt;p&gt;This action expects three things in order: a &lt;a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token"&gt;GitHub Personal Access Token&lt;/a&gt; with "gist" scope, either the "create" or "update" command, and a space delimited list of blog post (markdown) files to process. Create a &lt;a href="https://docs.github.com/en/actions/security-guides/encrypted-secrets"&gt;secret within the repo you're using&lt;/a&gt; named GISTS_TOKEN and store the value of the aforementioned personal access token. The secret can be securely accessed as shown in the below examples.&lt;/p&gt;
&lt;h2&gt;
gists-token&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;description: A valid GitHub Personal Access Token with "gist" scope.&lt;/li&gt;
&lt;li&gt;required: true&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
operation&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;description: The operation to perform either "create" or "update".&lt;/li&gt;
&lt;li&gt;required: true&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
blog-files&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;description: A space delimited list of files to process.&lt;/li&gt;
&lt;li&gt;required: true&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
Outputs&lt;/h2&gt;
&lt;p&gt;None.&lt;/p&gt;
&lt;h2&gt;
Example usage&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://github.com/seajoshc/gistblog#readme"&gt;As&lt;/a&gt;…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/seajoshc/gistblog-action"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;p&gt;You can see &lt;a href="https://github.com/seajoshc"&gt;my personal Gistblog here&lt;/a&gt; and a table of &lt;a href="https://gist.github.com/seajoshc/d898750deca042b9b241ad8b79bcac96"&gt;all my posts using Gistblog here&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Why does this exist????
&lt;/h4&gt;

&lt;p&gt;Why Gists when you can blog on &lt;a href="//dev.to"&gt;DEV&lt;/a&gt;? Yeah that's a bit awkward 😅 But it's all good, I'm entering the Whacky Wildcards category 🤣 A short backstory...&lt;/p&gt;

&lt;p&gt;I don't quite know what triggered it but one night in early November 2021 I decided that I wanted to start blogging every once in awhile again. It doesn't matter that few, if any, people will ever read the things I write. It's just a creative outlet. But regardless, as always I was paralyzed by all the choices I had for which blog platform/engine to use. I decided to just put my first post in a &lt;a href="https://gist.github.com/"&gt;GitHub Gist&lt;/a&gt; to get the ball rolling, thinking I would move it elsewhere later. But then I thought it might be kind of cool to continue using Gists for blogging since it was so easy. I started looking more into the APIs and discovered that a workflow around blogging via Gists was definitely feasible. It also just so happened that the &lt;a href="https://dev.to/devteam/join-us-for-the-2021-github-actions-hackathon-on-dev-4hn4"&gt;2021 GitHub Actions Hackathon&lt;/a&gt; was going on, so as any good developer does... I decided to make my own &lt;del&gt;Rube Goldberg machine&lt;/del&gt; blog engine instead of trying to pick one! A few weeks later I am happy to introduce... &lt;a href="https://github.com/seajoshc/gistblog"&gt;Gistblog!&lt;/a&gt; &lt;/p&gt;

</description>
      <category>actionshackathon21</category>
      <category>github</category>
    </item>
  </channel>
</rss>
