DEV Community

loading...
Play Button Pause Button
GitHub

Assigning new contributors to issues using GitHub Actions

bdougieyo profile image Brian Douglas Updated on ・2 min read

When most folks consider GitHub Actions, they continuous integration or continuous delivery, a portion of the Actions I use in my workflows focus on the webhook events related to issue comments.

Now and again, I get a user interested in contributing to my projects, and I'm always looking to make sure every contributor can have a tremendous first contributor experience.

There have been times when my project gets more attention than normal, and I'll have multiple users trying to contribute to the same issue. So to prevent this, I provide context and steps for contributing inside my CONTRIBUTING.MD. Inside this doc, there are detailed instructions on how to take an issue and claim it.

// https://github.com/open-sauced/open-sauced/blob/main/.github/workflows/assign-yourself.yml

name: Assign
on:
  issue_comment:
    types: [created, edited] // action runs on new and edited issue comments

jobs:
  one:
    runs-on: ubuntu-latest
    steps:
      # .take in an issue comment. 
      - name: take an issue
        uses: bdougie/take-action@main
        env:
          GITHUB_TOKEN: ${{ github.token }}
Enter fullscreen mode Exit fullscreen mode

Learn how I build this action on YouTube, Build GitHub Actions with a Docker Container

The way I power this feature is through a GitHub Action. Not allow any GitHub user the ability to assign an issue is an intentional security precaution. Only GitHub Organization members can assign themselves to issues.

Screen Shot 2021-02-05 at 1.19.40 PM

This can be a blocker during times like Hacktoberfest when you want to contribute to an issue, but you can't assign yourself as a non-org member. So I've taken the time to create an action called take-action. This is an Action. I've leveraged in my repo to provide the ability to have folks take action on issues.

GitHub logo bdougie / take-action

This is an action to assign yourself to an issue for a repo you are not a contributor to.

Take Action

This is an action to assign yourself to an issue for a repo you are not a contributor to.

Usage

This GitHub Action pins an issue based on a specified label.

Setup

# .github/workflows/take.yml 
name: Assign issue to contributor
on: 
  issue_comment:

jobs:
  assign:
    name: Take an issue
    runs-on: ubuntu-latest
    steps:
    - name: take the issue
      uses: bdougie/take-action@main
      env:
        GITHUB_TOKEN: ${{ github.token }}
Enter fullscreen mode Exit fullscreen mode

Now most Actions, including this one, are open source. So if you're interested in learning how to accomplish this, contributions are welcomed. Now any first-time contributor can check the assignee field to see what's ups for grabs. No more commenting on tasks to ask if this problem has been solved or currently being worked on.

This is part of my 28 days of Actions series. To get notified of more GitHub Action tips, follow the GitHub organization right here on Dev.

Discussion (0)

pic
Editor guide