DEV Community

Medea
Medea

Posted on

GitHub Actions with MongoDB

What I built

I have built an example of how you can connect MongoDB to GitHub Actions and use it as a reward system for a repo's contributors.

Category Submission:

This might be a DIY Deployments submission and the action runs on every push and helps figure out who the committer is.
If not, then it is a Wacky Wildcards submission.

App Link

The demo of the template can be found on https://github-actions-mongodb.vercel.app

Screenshots

Action runs when the contributor's token count goes up by 1.
action runs

The dashboard where you can buy rewards with the tokens you earned when contributing.
dashboard

Description

This project includes a GitHub actions that runs on every push, gets the username of the user that has committed, and adds one token to their username profile in MongoDB.
It also comes with a dashboard, where the user can login with GitHub and spend their tokens on items.

Link to Source Code

GitHub Actions with MongoDB

Information

This website has been made for the GitHub + DEV Hackathon.

It is an example of how you can connect MongoDB to GitHub Actions and use it as a reward system for a repo's contributors.

Seeing the template in action

Contribute here to earn some tokens and see this template in action!

Using this template

To use this template you must generate:

  • A MongoDB URI
  • A url to deploy this website on
  • A secret for NextAuth
  • A GitHub OAuth App ID
  • A GitHub OAuth App Secret

To make the GitHub Action run, you will need to set the MONGODB_URI as a repository secret for the action.

When deploying this template as a website, you must have the environment variables:

  • MONGODB_URI
  • NEXAUTH_URL
  • NEXTAUTH_SECRET
  • GITHUB_ID
  • GITHUB_SECRET

Thanks for checking out this template! Make sure to star it and follow VulcanWM for more content like this.




Permissive License

This project uses the license: Apache License 2.0

Background

I feel like a reward system always keeps me going and I wanted contributors to Open Source Communities to also feel the enthusiasm to keep them contributing.
I've always loved using MongoDB and I wanted to learn how to combine that with GitHub Actions.

How I built it

I used React and Next.js to create this website, and then I hosted it on Vercel.
I obviously used MongoDB as a database, as it is great for people who like using NoSQL databases.
I learnt how to create and use GitHub Actions, and I also learnt how to run specific files with npm.

Additional Resources/Info

I would like to give special thanks to the GitHub documentation for providing a lot of information which helped me create the Action.

Top comments (0)