Code Monkey home page Code Monkey logo

slash-assign-action's Introduction

โœ‹๐Ÿ’ช

[WIP] `/assign` action

GitHub Actions status


A GitHub Action that listens for a /assign "command" (an issue comment that starts with /assign) and assigns the commenter to the issue. It can also unassign issues that have been assigned for a configured amount of time.

Usage

name: Slash assign

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

jobs:
  slash_assign:
    # If the acton was triggered by a new comment that starts with `/assign`
    # or a on a schedule
    if: >
      (github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/assign')) ||
      github.event_name == 'schedule'
    runs-on: ubuntu-latest
    steps:
      - name: Assign the user or unassign stale assignments
        uses: JasonEtco/slash-assign-action@v1
        with:
          required_label: good-first-issue
          assigned_label: assigned-to-contributor

Why the if?

That big if property is there to prevent the action from running if it doesn't need to. Without it, it'll run on every single issue comment, and that can eat up your Actions minutes. The Action itself also checks for the /assign comment.

Options

assigned_label

A label that is added to issues when they're assigned, to track which issues were assigned by this action. Default: slash-assigned

required_label

If set, the issue must have this label to be assigned.

days_until_warning

The span of time (in days) between a user assigning themselves to the action commenting saying it will become unassigned. Default: 14

days_until_unassign

The span of time (in days) between a warning (see days_until_warning) and the issue being unassigned automatically. Default: 7

stale_assignment_label

The label applied when the assignment is stale (>= days_until_warning). Default: stale-assignment.

pin_label

A label that prevents the user from being unassigned, typically for issues that are expected to take a long time. Default: 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)

Default:

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.

warning_comment

The comment posted to warn a user that the issue will become unassigned. This is a Mustache template that supports the following variables:

  • user (the user that was assigned)
  • inputs (the inputs given to the action)
  • env (process.env, anything you pass to the action via env)

Default:

@{{ assignee.login }}, this issue hasn't had any activity in {{ inputs.days_until_warning }} days.

It will become unassigned in {{ inputs.days_until_unassign }} days to make room for someone else to contribute.

workflow_dispatch trigger

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'

slash-assign-action's People

Contributors

jasonetco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

slash-assign-action's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.