A GitHub App built with Probot that can submit tips on behalf of a Substrate based network.
This bot relies on GitHub pull request that opt in via a body text comment to specify what Substrate network and address to send tips to.
{kusama|polkadot|localtest} address: <SS58 Address>
Followed by a comment on said pull request
/tip {small | medium | large}
To use this bot, you'll need to have an .env
file. Most of the options will
automatically be generated by the GitHub application creation process, but you will also need to add
ACCOUNT_SEED
and ALLOWED_USERS
.
A reference env file is placed at .env.example
to copy over
$ cp .env.example .env
- Follow readme in https://github.com/paritytech/polkadot#development to run local network.
- Among all dependencies, main steps are (from repo):
- Compile
cargo b -r
- Run
./target/release/polkadot --dev
- Compile
- Among all dependencies, main steps are (from repo):
- Create 2 accounts: for "bot" & for "contributor"
- Save the seeds & passwords somewhere
- Set
ACCOUNT_SEED
as bot's seed in.env
file
- Transfer some meaningful amount from test accounts (like Alice) to a new bot account (from which bot will be send tip to the contributor)
- Note: During app creation save according env variables to
.env
file - Read Getting-started doc to get a sense of how to work with bots
- Follow creating app and installing app guidance
WEBHOOK_PROXY_URL
you can generate via https://smee.io/new
- Issues: Read-only
- Allows for interacting with the comments API
- Pull Requests: Read & write
- Allows for posting comments on pull requests
- Members: Read-only
- Related to $ALLOWED_ORGANIZATIONS: this permission enables the bot to request the organization membership of the command's requester even if their membership is private
- Issue comment
- Allows for receiving events for pull request comments
After registering and configuring the bot environment, we can run it. We use
Nodemon for hot-reloading, the probot
package
automatically parses the relevant .env
values.
$ yarn start
You'll need 2 gh users: contributor and maintainer (since it's not allowed for contributors to send a tip to themselves)
- From contributor GH account: create a PR and add into PR description
localtest address: <contributor polkadot address>
- From maintainer GH account: write
/tip small
in comments so the bot sends funds to
To run the bot via Docker, we need to build and then run it like so
$ docker build -t substrate-tip-bot .
$ docker run \
-e APP_ID=<app-id> \
-e PRIVATE_KEY=<pem-value> \
substrate-tip-bot
If you have suggestions for how substrate-tip-bot could be improved, or want to report a bug, open an issue! We'd love all and any contributions.
For more, check out the Contributing Guide.
MIT © 2021 Parity Technologies admin@parity.io