GitHub Action
Toot, together!
For Open Source or event maintainers that share a project Mastodon account, toot-together
is a GitHub Action that utilizes text files to publish toots from a GitHub repository. Rather than posting your toots directly, GitHub’s pull request review process encourages more collaboration, Mastodon activity and editorial contributions by enabling everyone to submit toot drafts to a project.
toot-together
is based on the amazing work of the twitter-together
project. ❤️
You can submit a toot to this repository to see the magic happen. Please follow the instructions at toots/README.md and mention your own Mastodon username in the toot. This repository has been set up to send toots via https://social.tchncs.de/@commit2toot.
-
Create a Mastodon app for your shared Mastodon account and store the credentials as
MASTODON_ACCESS_TOKEN
in your repository’s secrets settings. -
Create a
.github/workflows/toot-together.yml
file with the content below. Make sure to replace'master'
if you changed your repository's default branch.on: [push, pull_request] name: Toot, together! jobs: preview: name: Preview runs-on: ubuntu-latest if: github.event_name == 'pull_request' steps: - uses: joschi/[email protected] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} toot: name: Toot runs-on: ubuntu-latest if: github.event_name == 'push' && github.ref == 'refs/heads/master' steps: - name: checkout master uses: actions/checkout@v2 - name: Toot uses: joschi/[email protected] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # URL to the instance hosting your Mastodon account MASTODON_URL: https://www.mastodon.example/ MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
-
After creating or updating
.github/workflows/toot-together.yml
in your repository’s default branch, a pull request will be created with further instructions.
Happy collaborative tooting! 🐘
All contributions welcome!
Especially if you try toot-together
for the first time, I’d love to hear if you ran into any trouble. I greatly appreciate any documentation improvements to make things more clear, I am not a native English speaker myself.
See CONTRIBUTING.md for more information on how to contribute. You can also just say thanks 😊
Thanks goes to these wonderful people (emoji key):
Jason Etcovitch 🎨 📖 💻 | Erons 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!
toot-together
is using two workflows
push
event to publish new tootspull_request
event to validate and preview new toots
When triggered by the push
event, the script looks for added *.toot
files in the toots/
folder or subfolders. If there are any, a toot for each added *.toot
file is published.
If there is no toots/
subfolder, the script opens a pull request creating the folder with further instructions.
For the pull_request
event, the script handles only opened
and synchronize
actions. It looks for new *.toot
files in the toots/
folder or subfolders. If there are any, the length of each toot is validated. If one is too long, a failed check run with an explanation is created. If all toots are valid, a check run with a preview of all toots is created.
I think we can make Open Source more inclusive to people with more diverse interests by making it easier to contribute other things than code and documentation. I see a particularly big opportunity to be more welcoming towards editorial contributions by creating tools using GitHub’s Actions, Apps and custom user interfaces backed by GitHub’s REST & GraphQL APIs.
I’ve plenty more ideas that I’d like to build out. Please ping me on Mastodon if you’d like to chat: @[email protected].