shrutsureja / bounty-hook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bounty Hook

A simple webhook handler from github. Whenever the admins in the env file wite /bounty $xx in any PR comment then this accepts the webhook from the github and add bounty ammount, user who created PR and more details in a notion database and makes a tweet from the authorized twitter account about which user has won the bounty.

Steps to run locally

  • git clone
  • cp .examples.dev.vars .dev.vars populate the necessary environment variables
  • Uncomment the KV Namespace for the twitter part
bun install
bun run dev
  • Use a tool like ngrok to expose your local host to internet
  • Add a webhook in your repo pointing to your ngrok_url/webhook
  • Add the ngrok_url/twitter-callback to the enviroment variable and the in the twitter developer app settings as the callback url for using twitter part

Webhook configuration

image image

Twitter configuration

image image

Steps to deploy

  1. Generate the clientId and clientSecret in the twitter developer app with this settings
  • App Permissions as Read and Write
  • Type of app as Native App (public client)
  • Call backurl cloudflare_url/twitter-callback
  1. Also have the notion API keys.
  2. add the necessary enviroment variables in the wrangler.toml file and uncomment them
  3. run bun run deploy to deploy
  4. Create any 4 kv_namespace in the cloudflare account image
  5. Go to the cloudflare worker project > settings > variables > kv namespace bindings now make sure to add this 4 variable to different namespaces (KEEP THE SAME VARIABLE NAME) once done it will look like this and then hit deploy
access_token
refresh_token
codeVerifier
state

image 7. Now to setup twitter hit the URL cloudflare_url/twitter-setup and then authorise the twitter. 8. Make sure you have added the cloudflare_url/webhook in the github webhooks and then you are good to go.

About


Languages

Language:TypeScript 100.0%