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:
.github/workflows/auto-tweet-new-post.yml- GitHub Action that triggers on new posts
- Runs automatically when you push to master branch
.github/scripts/tweet-new-post.py- Python script that posts the tweet
- Extracts title and excerpt from your post
- Formats the tweet nicely
docs/X-API-SETUP-GUIDE.md- Step-by-step guide to get Twitter API credentials
docs/GITHUB-SECRETS-SETUP.md- Instructions for adding credentials to GitHub
๐ How It Works
Your normal workflow stays the same:
- Create blog post in
_posts/ - Write content in markdown
- Commit and push to GitHub
What happens automatically:
- GitHub Actions detects the new post
- Extracts title and excerpt
- Posts tweet: โ๐ New post: [Title] [Excerpt] [URL]โ
- 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:
- Go to: https://github.com/NightOwlCoder/NightOwlCoder.github.io/actions
- Click on the latest workflow run
- Watch it execute (takes ~30 seconds)
- Check your Twitter (@OwlCoder) for the new tweet!
๐ Troubleshooting
Workflow doesnโt run?
- Make sure you pushed to the
masterbranch - 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!