nightowlcoder@home:~$

Auto-Tweet Setup - Complete Guide

๐ŸŽ‰ Whatโ€™s Been Set Up

Iโ€™ve created a fully automated system that will tweet every time you publish a new blog post. Hereโ€™s whatโ€™s in place:

Files Created:

  1. .github/workflows/auto-tweet-new-post.yml
    • GitHub Action that triggers on new posts
    • Runs automatically when you push to master branch
  2. .github/scripts/tweet-new-post.py
    • Python script that posts the tweet
    • Extracts title and excerpt from your post
    • Formats the tweet nicely
  3. docs/X-API-SETUP-GUIDE.md
    • Step-by-step guide to get Twitter API credentials
  4. docs/GITHUB-SECRETS-SETUP.md
    • Instructions for adding credentials to GitHub

๐Ÿ“ How It Works

Your normal workflow stays the same:

  1. Create blog post in _posts/
  2. Write content in markdown
  3. Commit and push to GitHub

What happens automatically:

  1. GitHub Actions detects the new post
  2. Extracts title and excerpt
  3. Posts tweet: โ€œ๐Ÿ“ New post: [Title] [Excerpt] [URL]โ€
  4. Done! โœจ

โœ… Next Steps (Your To-Do List)

Step 1: Get Twitter API Credentials (5-10 minutes)

๐Ÿ“„ Follow: docs/X-API-SETUP-GUIDE.md

Youโ€™ll get 4 values:

  • API Key
  • API Key Secret
  • Access Token
  • Access Token Secret

Step 2: Add Secrets to GitHub (2 minutes)

๐Ÿ“„ Follow: docs/GITHUB-SECRETS-SETUP.md

Add the 4 credentials to your GitHub repository secrets.

Step 3: Test It! (optional)

Create a test blog post with an excerpt to see it work.


๐Ÿ“‹ Blog Post Format

Add an excerpt field to your front matter:

---
layout: post
title: "Your Awesome Post Title"
date: 2025-10-25 19:50:00 -0700
categories: category1 category2
excerpt: "A short 1-2 sentence summary for the tweet"
---

Example tweet that will be posted:

๐Ÿ“ New post: Your Awesome Post Title

A short 1-2 sentence summary for the tweet

https://nightowlcoder.github.io/your-awesome-post-title

If you donโ€™t add an excerpt:

๐Ÿ“ New post: Your Awesome Post Title

https://nightowlcoder.github.io/your-awesome-post-title

๐Ÿ” How to Check if It Worked

After pushing a new post:

  1. Go to: https://github.com/NightOwlCoder/NightOwlCoder.github.io/actions
  2. Click on the latest workflow run
  3. Watch it execute (takes ~30 seconds)
  4. Check your Twitter (@OwlCoder) for the new tweet!

๐Ÿ› Troubleshooting

Workflow doesnโ€™t run?

  • Make sure you pushed to the master branch
  • Check that your post is in _posts/ directory
  • Verify GitHub Actions are enabled in your repo settings

Tweet doesnโ€™t post?

  • Check the workflow logs in the Actions tab
  • Verify all 4 secrets are correctly added
  • Make sure your Twitter app has โ€œRead and Writeโ€ permissions

Tweet looks weird?

  • Check your excerpt length (keep it under 100-150 chars for best results)
  • Make sure your post has valid front matter with title

๐ŸŽฏ Benefits

โœ… Never forget to promote - Automatic on every push
โœ… Consistent format - Every tweet looks professional
โœ… Zero extra work - Part of your normal workflow
โœ… Custom excerpts - You control the message
โœ… Full automation - Set it and forget it


๐Ÿ“š Quick Reference

File Purpose
.github/workflows/auto-tweet-new-post.yml GitHub Action workflow
.github/scripts/tweet-new-post.py Tweet posting script
docs/X-API-SETUP-GUIDE.md Get Twitter credentials
docs/GITHUB-SECRETS-SETUP.md Add credentials to GitHub

Ready to get started? Follow Step 1 in the X-API-SETUP-GUIDE.md!