GitHub Integration
Reward users with points when they commit to a repository
Example: Automatically issue points to users when they commit code to your repo using Zapier and Absinthe’s API. Simply modify the Zapier Trigger from New Commit to any other GitHub Trigger
Setting Up GitHub Commit Listener
To reward users with points when they commit code to your repository, you’ll need to set up a Zap in Zapier that listens for commit events and then triggers a point issuance through Absinthe’s API.
Create a New Zap in Zapier
Log in to your Zapier account and click on “Create Zap”.
Choose GitHub as the Trigger App
Search for “GitHub” in the app selection and choose it as your trigger app.
Select the 'New Commit' Event
From the list of GitHub events, select “New Commit”.
Connect Your GitHub Account
If you haven’t already, you’ll need to connect your GitHub account to Zapier. Follow the prompts to authorize Zapier to access your GitHub.
Choose the GitHub repository
Select the specific GitHub repository you want to monitor for commits.
Test the GitHub Trigger
Zapier will attempt to find a recent commit to test the trigger. If successful, proceed to the next step.
Add a 'Run JavaScript' Action
For the action step, search for and select “Run JavaScript” by Zapier.
Set Up the JavaScript Action Data
In the Input Data field of the Run JavaScript action, you’ll set the key to user_email and the value to the Author Email from the dropdown.
Set Up the JavaScript Action Code
In the Code field of the Run JavaScript action, you’ll paste and modify the provided JavaScript code to issue points through Absinthe’s API.
Custom JavaScript Action
Use the given JavaScript code in your Zapier “Run JavaScript” action to issue points when a New Commit is created:
Customizing the Action Modify the JavaScript code to suit your specific needs:
Adjust the amount of points issued for each role assignment. Customize the event_name to distinguish between different Discord events.
Ensure you’re passing the necessary data (GitHub user email, etc) from the GitHub trigger step to the JavaScript action in Zapier.
Best Practices When setting up this GitHub Commit integration:
Use a clear and consistent event_name (e.g., “github_commit”) for easy tracking.
By following this guide, you can create a seamless integration between GitHub commits and your Absinthe points system, automatically rewarding users for their engagement within your repository.