Github Issue Agent
Use Votte to automatically create Github workflows
This example shows how you can use the Github API to automatically create issues for the latest trending repositories.
Keywords: vault, agent, github
Overview
Let’s first break down the problem into smaller parts. To solve this, we basically need two agents:
An agent that can scrape the latest trending repositories from Github.
An agent that can create an issue on Github for a given repository.
Furthermore, we need to remember which issues we have already created to avoid duplicates. We will use a .csv file as a simple database to store the issues we have already created.
Setup environment variables & python environment
First, you need to set up the following environment variables:
Copy
# Votte credentials.
VOTTE_API_KEY=<your-votte-api-key>
# Github credentials: make sure to set up MFA secret to use this.
GITHUB_COM_EMAIL=<your-github-email>
GITHUB_COM_PASSWORD=<your-github-password>
GITHUB_COM_MFA_SECRET=<your-github-mfa-secret>Make sure to also create a new python environment and install the following packages:
Copy
Step 1: Trending Repos Agent
Let’s start by defining the types required to scrape the latest trending repositories from Github. Trending repositories are defined by their:
Organization name
Repository name
URL
Description
Number of stars
Number of forks
For issues, we simply need the issue URL and a boolean indicating if the issue has been created.
Our trending repo scraping agent, doesn’t need to be a multi-step agent. We can simply scrape the latest trending repositories from Github in one go. Github already reports the trending repos at https://github.com/trending. We just need to scrape the page and use structured output to get the trending repos:
Step 2: Create Github Issue Agent
Safely store your Github credentials
To post an issue on Github, we need to be logged in with a valid Github account. Votte allows you to safely store your Github credentials in a vault.
Create Github Issue Agent
This is the final step. We will votte agents to create a Github issue for all the trending repos fetching in the previous step.
Put all parts together
In previous steps, we have defined both create_github_issue and fetch_trending_repos agents. Now, we can put all parts together.
But before that, as discussed in the overview, we need to store the trending repos in a csv file to avoid duplicates. We will define a CsvLogger class to do this:
Finally, we can put all parts together:
Conclusion
In this example, we have seen how to use Votte to create a Github issue for all the trending repos. We have also seen how to safely store your Github credentials in a vault.
In a few lines of code, we have been able to create a Github issue for all the trending repos which automatically logs the issues created in a csv file.
You can find the full code in the Github repo along with many other examples.
Last updated