Skip to content

πŸ€– A github action that assign issues based on "/assign" command (or any trigger you want to use)

License

Notifications You must be signed in to change notification settings

takanome-dev/assign-issue-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

πŸ’¬ Assign Issue Action βœ‹

Licence Badge Release Badge GitHub Actions status GitHub Actions status


A GitHub Action that listens for a /assign "command" (or any trigger you want) and assigns the issue to the user who commented (or the user who triggered the action). It can also unassign issues that have been assigned for a configured amount of time.

This Action is heavily inspired by JasonEtco/slash-assign-action

πŸ“Έ Screenshots

assign_1 assign_2

πŸš€ Usage

Create a workflow (eg: .github/workflows/assign.yml learn more about Creating a Workflow file) to utilize the trigger action with content:

name: Assign Issue

on:
  schedule:
    - cron: 0 0 * * *
  issue_comment:
    types: [created]
  workflow_dispatch:

jobs:
  assign:
    runs-on: ubuntu-latest
    steps:
      - name: Assign the user or unassign stale assignments
        uses: takanome-dev/assign-issue-action@v2.1.1
        with:
          github_token: '${{ secrets.GITHUB_TOKEN }}'
          # trigger: '/assign-me' # you can change the default trigger to something else
          # required_label: # if present, the issue must have this label to be assigned
          # assigned_label: πŸ“ Assigned
          # days_until_unassign: 7
          # learn more about the inputs below ⬇

Inputs

Various inputs are defined in action.yml to let you configure the action:

Name Description Default
github_token PAT for GitHub API authentication. It's automatically generated when the action is running, so no need to add it into your secrets. ${{ github.token }}
trigger The comment that triggers the action. This can be anything you want. /assign-me
assigned_label A label that is added to issues when they're assigned, to track which issues were assigned by this action. πŸ“ Assigned
required_label If set, the issue must have this label to be assigned. N/A
days_until_unassign The span of time between a user assigning themselves to the issue being unassigned automatically by the action. 7
πŸ“Œ pin_label A label that prevents the user from being unassigned, typically for issues that are expected to take a long time. Pinned
assigned_comment The comment posted after a user has assigned themselves to an issue.
The following variables are supported:
- inputs: the inputs given to the action
- comment: an object holding the commenter infos
- totalDays: days_until_unassign
πŸ‘‹ Hey @{{ comment.user.login }}, thanks for your interest in this issue! πŸŽ‰<br>⚠ Note that this issue will become unassigned if it isn't closed within **{{ totalDays }} days**.<br><br>πŸ”§ A maintainer can also add the **{{ inputs.pin_label }}** label to prevent it from being unassigned automatically.<br>
already_assigned_comment The comment posted when a user tries to assign themselves to an issue that is already assigned. πŸ‘‹ Hey @{{ comment.user.login }}, this issue is already assigned to @{{ assignee.login }}.<br>⚠️ It will become unassigned if it isn't closed within **{{ daysUntilUnassign }} days**. <br><br>πŸ”§ A maintainer can also add you to the list of assignees or swap you with the current assignee.<br>

✏️ Contributing

We would love you to contribute to this project, pull requests are welcome! Please see the CONTRIBUTING.md for more information.

βš–οΈ Licence

The scripts and documentation in this project are released under the MIT License