Skip to content

fpapado/org-release-announcer-twitter

Repository files navigation

org-release-announcer-twitter

A GitHub App built with probot that announces releases to Twitter from the organisation or repository where it is installed.

This app is intended to be self-hosted, see how do I run this? for more details.

demo

Setup

# Install dependencies
npm install

# Run the bot
npm start

Organisation

The library lives under lib/index.js. It allows you to plug in "announcers" of the form:

{
  announce: function(event)
}

In this case, the announcer posts things to Twitter. It is found under lib/twitterAnnouncer.js. The root index.js is a sample app that links together the Twitter announcer and the app.

How do I run this?

You can find a more template-y version of this on Glitch.

Self-hosting would be my recommendation; I certainly don't want access to your data, and you likely have specific requirements for how to announce things :)

  1. Fork/Clone/Copy this repository:
git clone https://github.com/fpapado/org-release-announcer-twitter.git

Degit is a good tool for this

  1. Make any customisations you want to lib/twitterAnnouncer.js.

  2. Copy .env.example to .env. Use those files as reference whenever .env and API Keys are mentioned in the docs below.

  3. See https://botwiki.org/resource/tutorial/how-to-create-a-twitter-app/ for how to create a Twitter App and get the API keys/secrets for it.

  4. See Probot's docs about the permissions and specifics of setting up the Github App. This app requires these Permissions & events for the GitHub App:

  • Repository contents - Read-only
  • Repository metadata - Read-only
    • Check the box for Release events
  1. See Probot's docs for deployment for deployment options. Remember to also set the Twitter environment variables (as mentioned above), in addition to the Github App ones that it specifies.

Testing

Run the tests with npm:

npm test

⚠️ Note that this posts about the org-release-announcer. Refer to https://probot.github.io/docs/simulating-webhooks/ for how to generate your own fixtures, if needed. ⚠️

You can also simulate a release event from the fixtures. By default, it prints the announcement to the console:

npm run dryrun:simulate:release

If you want to verify the Twitter integration, you would have to make a post of the fixture:

npm run live:simulate:release

Thanks and Inspiration

Credits to the Glitch starter templates:

For Probot: https://glitch.com/~probot-hello-world

For Twitter: https://glitch.com/~twitterbot

About

🤖 🎉 GitHub App to announce releases to Twitter from an org or repo.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published