Schedule daily tweets from markdown files in your repo, posted via github actions.

markdown-tweet-scheduler

Schedule daily tweets from markdown files in your repo, posted to twitter via github actions.

Setup

  1. Fork this repo
  2. Get your twitter credentials (https://developer.twitter.com/en)
  3. Add your twitter credentials to the repository's secrets (https://docs.github.com/en/actions/reference/encrypted-secrets)
    • API_KEY (known as consumer_key in twitter API)
    • API_SECRET_KEY (known as consumer_secret in twitter API)
    • ACCESS_TOKEN
    • ACCESS_TOKEN_SECRET
  4. Create a markdown file in the ./tweets/ folder with tomorrow's date in YYYY-Mon-DD format, for example, 2021-Sep-05.md, and write the content of your tweet in it.
  5. Commit the markdown file and it should post on the date specified in the filename.

Why

  • View, edit, and post your tweets without logging into twitter manually
  • Keep source controlled backups of your tweets
  • Free and open source

Configuration

  1. By default, posts tweets around 7:02AM PT (2:02 UTC). To change the time of day tweets are posted:

    • Set the cron section of .github/workflows/go.yml to the time you want the tweet to post https://cron.help/
  2. Changing the tweet directory:

    • Change the FILE_PATH environment variable in .github/workflows/go.yml

Running locally

  1. rename .env-SAMPLE to .env and fill in your twitter credentials
    • consumer_key == API_KEY
    • consumer_secret == API_SECRET_KEY
  2. In your terminal: go run main.go

Notes

  1. Fails silently on bad credentials, make sure you set those correctly.
  2. Only allows one tweet per day by design. If requested, this can be modified to allow tweets by the minute or hour.
  3. I suggest moving posted tweets that have already been posted to a posted/ subdirectory under tweets/.
  4. Tweets will not be posted exactly at the cron time set in go.yml because of how github actions work. If you need minute precision, run this script locally on a cronjob.
Owner
reid j sherman
Software Developer
reid j sherman
Comments
  • Feature Request: Enable frontmatter to allow more descriptive filenames

    Feature Request: Enable frontmatter to allow more descriptive filenames

    What about an alternative format that lets you have a more descriptive filename but the markdown file contains frontmatter that has the date in it? GitHub supports markdown files with frontmatter. (frontmatter is header values in YAML format surrounded by ---)

    suggested by https://github.com/swharden @swharden

    (shouldn't break the original workflow)

  • Add new reader that reads all files by their name and metadata

    Add new reader that reads all files by their name and metadata

    Hi! this PR address the feature requested on issue #14.

    In other to do this I add a custom renderer that uses the goldmark lib to interpret the front matter information.

    This PR also add the possibility to schedule more than one twitte in the same run

  • Add a queue system

    Add a queue system

    Allow queueing daily posts to prevent having to pick a date to post Idea: file names starting with the letter q are picked in order, (lowest q goes first) q0.md q1.md q2.md q12.md etc

  • Feature Request: Schedule Multiple Tweets Per Day

    Feature Request: Schedule Multiple Tweets Per Day

    If hour and minutes are present in a Tweet's filename, a github action to post that tweet should run at the given datetime. If only Month, Day, Year are in the filename, it should run at the default time of day.

    Example: August 17, 2021.md posts at regular time August 17, 2021 11:53.md posts at 11:53am GMT August 17, 2021 14:22.md posts at 2:22pm GMT

    It would be even better if there was a config var called 'TIMEZONE' in the .env so instead of GMT it would set it to local time 🤔

  • Queueing system will post the same tweet post if user doesn't rename the file after posting

    Queueing system will post the same tweet post if user doesn't rename the file after posting

    Queueing system shouldn't be used until this is fixed (Post by date should be unaffected)

    The github action doesn't rename the file in the repo, so it will just post the highest priority tweet every day (q-1).

    After posting a queued tweet, we have to automatically:

    1. rename the file to something that doesn't start with q-, ideally the name should be updated to the date it was posted
    2. commit the name change and,
    3. push the updated file to the repo.

    Otherwise, at the next run it will attempt to tweet the same thing again.

  • Add tests

    Add tests

    Tests to write:

    1. if no scheduled tweets, posts a queued tweet
    2. if no queued tweets, fails gracefully
    3. check renaming scheme (posted, failed, attempted)
  • Add an interface to check the order of tweets at a glance

    Add an interface to check the order of tweets at a glance

    I want to know the next tweet(s) to be posted from the remote repo using my local machine

    One way this could work is that on push it generates a file of future tweets, in order of when they will be posted in descending order.

    It would be cool if that file would act as the source of truth and would be parsed by the script to determine the next tweet

  • Instead of running daily, schedule the script to run at the next tweet scheduled time

    Instead of running daily, schedule the script to run at the next tweet scheduled time

    Currently, the script runs daily, regardless of whether or not a tweet is scheduled. It would be better to schedule the workflow at the time of the next tweet. This would fix issue #1 as well.

Markdown - Markdown converter for golang

markdown ?? Talks ?? Join ?? Youtube ❤️ Sponsor Install via nami nami install ma

Jun 2, 2022
Mdfmt - A Markdown formatter that follow the CommonMark. Like gofmt, but for Markdown

Introduction A Markdown formatter that follow the CommonMark. Like gofmt, but fo

Dec 18, 2022
Convert your markdown files to PDF instantly
Convert your markdown files to PDF instantly

Will take a markdown file as input and then create a PDF file with the markdown formatting.

Nov 7, 2022
Parse data and test fixtures from markdown files, and patch them programmatically, too.

go-testmark Do you need test fixtures and example data for your project, in a language agnostic way? Do you want it to be easy to combine with documen

Oct 31, 2022
Generate a global index for multiple markdown files recursively
Generate a global index for multiple markdown files recursively

markdown index Markdown-index is a library to help you generate a global index for multiple markdown files recursively in a directory, containing a su

Sep 25, 2022
Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️
Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️

Glamour Write handsome command-line tools with Glamour. glamour lets you render markdown documents & templates on ANSI compatible terminals. You can c

Jan 1, 2023
:zap: Transfer files over wifi from your computer to your mobile device by scanning a QR code without leaving the terminal.
:zap: Transfer files over wifi from your computer to your mobile device by scanning a QR code without leaving the terminal.

$ qrcp Transfer files over Wi-Fi from your computer to a mobile device by scanning a QR code without leaving the terminal. You can support development

Dec 28, 2022
Blackfriday: a markdown processor for Go

Blackfriday Blackfriday is a Markdown processor implemented in Go. It is paranoid about its input (so you can safely feed it user-supplied data), it i

Jan 8, 2023
⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules.
⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules.

html-to-markdown Convert HTML into Markdown with Go. It is using an HTML Parser to avoid the use of regexp as much as possible. That should prevent so

Jan 6, 2023
Produces a set of tags from given source. Source can be either an HTML page, Markdown document or a plain text. Supports English, Russian, Chinese, Hindi, Spanish, Arabic, Japanese, German, Hebrew, French and Korean languages.
Produces a set of tags from given source. Source can be either an HTML page, Markdown document or a plain text. Supports English, Russian, Chinese, Hindi, Spanish, Arabic, Japanese, German, Hebrew, French and Korean languages.

Tagify Gets STDIN, file or HTTP address as an input and returns a list of most popular words ordered by popularity as an output. More info about what

Dec 19, 2022
Upskirt markdown library bindings for Go

Goskirt Package goskirt provides Go-bindings for the excellent Sundown Markdown parser. (F/K/A Upskirt). To use goskirt, create a new Goskirt-value wi

Oct 23, 2022
A CLI markdown converter written in Go.

MDConv is a markdown converter written in Go. It is able to create PDF and HTML files from Markdown without using LaTeX. Instead MDConv u

Dec 20, 2022
A markdown renderer package for the terminal
A markdown renderer package for the terminal

go-term-markdown go-term-markdown is a go package implementing a Markdown renderer for the terminal. Note: Markdown being originally designed to rende

Nov 25, 2022
A markdown parser written in Go. Easy to extend, standard(CommonMark) compliant, well structured.

goldmark A Markdown parser written in Go. Easy to extend, standards-compliant, well-structured. goldmark is compliant with CommonMark 0.29. Motivation

Dec 29, 2022
:triangular_ruler:gofmtmd formats go source code block in Markdown. detects fenced code & formats code using gofmt.
:triangular_ruler:gofmtmd formats go source code block in Markdown. detects fenced code & formats code using gofmt.

gofmtmd gofmtmd formats go source code block in Markdown. detects fenced code & formats code using gofmt. Installation $ go get github.com/po3rin/gofm

Oct 31, 2022
Convert Microsoft Word Document to Markdown
Convert Microsoft Word Document to Markdown

docx2md Convert Microsoft Word Document to Markdown Usage $ docx2md NewDocument.docx Installation $ go get github.com/mattn/docx2md Supported Styles

Jan 4, 2023
go-md2man - 转换 Markdown 为 man 手册内容

go-md2man Converts markdown into roff (man pages). Uses blackfriday to process markdown into man pages. Usage ./md2man -in /path/to/markdownfile.md -o

Dec 22, 2022
A PDF renderer for the goldmark markdown parser.
A PDF renderer for the goldmark markdown parser.

goldmark-pdf goldmark-pdf is a renderer for goldmark that allows rendering to PDF. Reference See https://pkg.go.dev/github.com/stephenafamo/goldmark-p

Jan 7, 2023
Markdown to Webpage app

mark2web Markdown to webpage link Usage $ mark2web test.md https://mark2web.test/aa32d8f230ef9d44c3a7acb55b572c8599502701 $ mark2web /tmp/session/test

Apr 18, 2021