GitHub Action
Assign Me Action
A GitHub Action that listens for a /assign-to-me
"command" (an issue comment that starts with /assign-to-me
) and assigns the commenter to the issue.
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
Create a workflow (eg: .github/workflows/assign-to-me.yml
learn more about Creating a Workflow file) to utilize the assign-to-me
action with content:
name: Assign To Me Action
on:
schedule:
- cron: 0 0 * * *
issue_comment:
types: [created]
jobs:
assign:
# If the acton was triggered by a new comment that starts with `/assign-to-me`
# or a on a schedule
if: >
(github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/assign-to-me')) ||
github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- name: Assign the user or unassign stale assignments
uses: takanome-dev/[email protected]
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
required_label: good-first-issue # you can change this label if you wish
assigned_label: Is-Assigned # you can change this label if you wish
Various inputs are defined in action.yml to let you configure the action:
Name | Description | Default |
---|---|---|
github_token |
PAT for GitHub API authentication | ${{ github.token }} |
assigned_label |
A label that is added to issues when they're assigned, to track which issues were assigned by this action. | Is-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. This is a Mustache template that supports the following variables: - inputs (the inputs given to the action) - comment (an object of the comment that was created) - totalDays (days_until_warning + days_until_unassign ) - env (process.env , anything you pass to the action via env ) |
This issue [has been assigned]({{ comment.html_url }}) to {{ comment.user.login }}! It will become unassigned if it isn't closed within {{ totalDays }} days. A maintainer can also add the **{{ inputs.pin_label }}** label to prevent it from being unassigned. |
You can also manually trigger this action via the workflow_dispatch
event. You'll need to modify the if
property:
if: >
(github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/assign')) ||
github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
We would love you to contribute to takanome-dev/assign-to-me-action
, pull requests are welcome!
Please see the CONTRIBUTING.md for more information.
The scripts and documentation in this project are released under the MIT License