Coder Social home page Coder Social logo

buildooor / github-attestation-bot Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 129 KB

Github EAS Attestation Bot

Home Page: https://github.com/buildooor/github-attestation-bot

License: MIT License

Dockerfile 1.33% Makefile 1.17% TypeScript 93.77% JavaScript 3.73%
actions arbitrum bot eas ethereum ethereum-attestation-service github github-actions github-bot mainnet

github-attestation-bot's Introduction

GitHub PR Attestation Bot

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

Demo Bot Install

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 your own bot

Development

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.

Docker

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

Github App Setup

You will need to create a Github App to use trigger the bot server via webhooks.

  1. Go to [https://github.com/settings/apps]
  2. Click "New Github App" button
  3. Fill out "GitHub App name" and "Homepage URL" fields
  4. 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.
  5. Under "Repository permissions" and "Pull requests", select "Read and write" access
  6. Under "Subscribe to events", check "Pull request"
  7. Click "Create GitHub App"
  8. After creation, click on "Generate a private key"
  9. Click on "Permissions & events" on the sidebar

References

License

MIT

github-attestation-bot's People

Contributors

buildooor avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.