Time-limited Issue Claiming - GitHub Bot
If you manage a popular GitHub repo, sometimes you might wish to allow non-maintainers to work on certain issues without letting them hold onto the issue indefinitely. Additionally, you might want to automate this type of temporary claim. This GitHub bot is designed to do just that!
Non-maintainers can comment
claim on an issue to claim it. They cannot claim issues that have already been assigned to someone else. Once they've claimed the issue, they'll be assigned it for a period of time that's defined while installing this app.
If a maintainer can no longer work on an issue, they can comment
unclaim to remove their assignment. Additionally, their assignment will automatically be unclaimed if someone else claims it (which is possible after their initial claim expires).
You can also set a maximum number of claims a single user can have at once in the settings of this app.
You Will Need
- A GitHub repo (or multiple repos) that you own and wish to add this bot to
- A GitHub account which this bot will post as - we recommend not using your regular account
Cloning the Google Sheet
This project stores data in a Google Sheet as an alternative to requiring you to setup a database. You'll need to clone our template to use this project.
- Head over to this link. From there, click
Make a copy.
- Choose a name for your copy of the sheet, select the folder it should be stored it, then click
Make a copy.
Our Google Sheet is ready to go! Now lets get our GitHub Repo setup.
Adding your bot's account to your GitHub Repo
- Login to the GitHub account that owns your repo. Once you're logged in, open your repo. Then, click the
Settings tab, click
Collaborators on the sidebar, then click the
Add People button.
- Enter the name of your bot's GitHub account, click it on the dropdown, then click
Add [name] to this repository.
- Click the
Pending Invite text to copy the link to accept the invite to your clipboard.
- Open an Incognito/Private Browsing window. In this window, login to your bot's GitHub account. Then, go to the link you just copied and click
Repeat these steps for each repo that you'd like your bot to run in.
Awesome! The GitHub account that your bot will post as is now connected to your repo. We can now move onto giving our Autocode project the ability to post as your bot.
Getting your bot's Personal Access Token
We'll use a personal access token to post on behalf of our bot.
- In the incognito you opened earlier (while logged into your bot's account) visit this link. Then, click
Generate New Token.
Fill out the following values on the form that appears:
- Note - give your token a name. This is only for your reference.
- Expiration - we recommend setting this to
No expiration. If you'd prefer to have your token expire, set it to the value of your choice. If you do set your token to expire, you'll need to update the
GITHUB_AUTH environment variable of this project every time you generate a new token.
- Select Scopes - check the
repo scope. You do not need to check any other option.
- Your personal access token will then appear. Copy it somewhere safe - you'll need it shortly.
Installing the Autocode App
You've got all the different parts you need to setup your bot... so let's set it up!
- Scroll up on this page and click the green
Install Free button.
- Select which organization you'd like to install this app to, give your project a name, then click
- For both the GitHub and Google Sheets linked resources, click the
Link button then the
Link New Resource button in the window that pops up.
- Make sure you link your GitHub resource to the account that owns your repos (not the bot account). You should also only select the repos that you'd like the claim system to run on when choosing which repositories to link this resource to.
- Make sure you select the Google Sheet you copied from the template earlier when when setting up your Google Sheets linked resource.
- Your screen should now look similar to the screenshot below. If it does, click the
Last step! We'll now configure our bot's settings.
- Claim Length - set to the maximum amount of time, in hours, that a claim will last before expiring.
- Max Claims - set to the maximum number of claims a user can have at one time.
- GitHub Auth - paste in the GitHub Personal Access Token you copied down earlier.
Once you've set these values, click the green
Install App button.
Congratulations! Your bot is ready to use!