https://github.com/code100x/bounty-hook
https://github.com/code100x/bounty-hook
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/code100x/bounty-hook
- Owner: code100x
- Created: 2024-05-07T05:00:01.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-12T18:55:55.000Z (about 2 years ago)
- Last Synced: 2024-05-12T19:37:41.877Z (about 2 years ago)
- Language: TypeScript
- Size: 37.1 KB
- Stars: 10
- Watchers: 2
- Forks: 15
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](https://ngrok.com/) 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


## Twitter configuration


## 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`
2. Also have the notion API keys.
3. add the necessary enviroment variables in the `wrangler.toml` file and uncomment them
4. run `bun run deploy` to deploy
5. Create any 4 kv_namespace in the cloudflare account

6. 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
```

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.