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.
# Install dependencies
npm install
# Run the bot
npm start
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.
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 :)
- Fork/Clone/Copy this repository:
git clone https://github.com/fpapado/org-release-announcer-twitter.git
-
Make any customisations you want to
lib/twitterAnnouncer.js
. -
Copy
.env.example
to.env
. Use those files as reference whenever.env
and API Keys are mentioned in the docs below. -
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.
-
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
- 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.
Run the tests with npm:
npm test
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
Credits to the Glitch starter templates:
For Probot: https://glitch.com/~probot-hello-world
For Twitter: https://glitch.com/~twitterbot