A GitHub PR Attestation Bot that automatically make an attestation to the Ethereum Attestation Service every time a PR is merged into a repository's main branch. This attestation contains a reference to the repository, the specific PR number, the branch name the PR was merged to, and the GitHub username of the account that created the PR.
Example pull request merged with attestation bot submission:
buildooor/github-action-test#31
https://github.com/apps/pr-attestation
Install the demo bot on your repository to see how it works. The bot will automatically make an attestation to the Ethereum Attestation Service on Sepolia every time a PR is merged into the master
branch of the selected repository.
Install dependencies:
npm install
Build:
npm run build
Set up environmtent variables:
cp sample.env .env
Environment variables:
# Signer private key (required)
PRIVATE_KEY=
# Github personal token of bot account (required)
GITHUB_TOKEN=
# Github webook secret (optional)
GITHUB_WEBHOOK_SECRET=
# Network to post attestation to (default "sepolia")
NETWORK=sepolia
# RPC URL to use (optional)
RPC_URL=
# The main branch to trigger attestations on when PR is merged (default "main")
BRANCH=main
Run:
npm run start
The webhook will be available at http://localhost:8000/payload
.
Alternatively, you can run the bot in a Docker container.
Build:
docker build -t github-attestation-bot .
Run:
docker run --env-file=.env -p 8000:8000 github-attestation-bot
You will need to create a Github App to use trigger the bot server via webhooks.
- Go to [https://github.com/settings/apps]
- Click "New Github App" button
- Fill out "GitHub App name" and "Homepage URL" fields
- Fill out "Webhook URL", add the URL of the bot server:
http://<bot-server-ip>:8000/payload
. If you are running the bot locally, you can use ngrok to create a tunnel to your local server. - Under "Repository permissions" and "Pull requests", select "Read and write" access
- Under "Subscribe to events", check "Pull request"
- Click "Create GitHub App"
- After creation, click on "Generate a private key"
- Click on "Permissions & events" on the sidebar