Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
activity

GitHub Action

Handle Multiple Issues

v1.0.0

Handle Multiple Issues

activity

Handle Multiple Issues

Handle the current issue if the author has existing open issues

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Handle Multiple Issues

uses: Anmol-Baranwal/handle-multiple-issues@v1.0.0

Learn more about this action in Anmol-Baranwal/handle-multiple-issues

Choose a version

Handle Multiple Issues

ℹ️ This GitHub workflow is designed for open source projects where users are allowed to create only one issue at a time.

With this GitHub workflow, you can automate tasks whenever an author creates multiple open issues.

Use cases

  • The workflow can comment the issues that are already created by the author which are currently in the open state.
  • You can add your own comment message (even multiline) in the issue.
  • Add a custom label on the issue.
  • Optionally, you can also close the issue (previous issues won't be affected), and only the current issue will be closed.

🚀 Getting Started

  • For custom configuration in-depth, you can check examples.
on:
  issues:
    types:
      - reopened
      - opened
jobs:
  handle-multiple-issues:
    runs-on: ubuntu-latest
    steps:
      - name: Handle Multiple Issues
        uses: Anmol-Baranwal/handle-multiple-issues@main
        with:
          label: "multiple issues" #default
          close: false  #default
          issueNumber: true  #default is false
          gh-token: ${{ secrets.GITHUB_TOKEN }} # this is mandatory

Inputs

Various inputs are defined to let you configure the action:

Name Description Default
gh-token The GitHub token for authentication N/A
label A label to add if the conditions are fulfilled 'multiple issues'
comment A message to comment on the issue ''
close This will close the issue if set to true 'false'
issueNumber This will comment all the previous issues that are created by the author 'potential-duplicate'

The four Combinations that you can use with comment and issueNumber:

Suppose, a user has created #1, #2 which are currently open and we have now included this workflow. Now suppose he creates the #3 issue.

You can see the examples for better clarity.

issueNumber comment Purpose Message by Bot
true To mention issue number with the default message #2, #1 is already opened by you
true custom_message To mention issue number with a custom message #2, #1 custom_message
false custom_message Custom message without mentioning issue custom_message
false Nothing is mentioned; only the label is added as per the workflow

🔖 Examples

Add a custom label and print the issue number with a default message
uses: Anmol-Baranwal/handle-multiple-issues@main
with:
  label: "up for grabs" #default is 'multiple issues'
  close: false  #default
  issueNumber: true  #default is false
  gh-token: ${{ secrets.GITHUB_TOKEN }}

Add a default label and print the issue number with a custom message
uses: Anmol-Baranwal/handle-multiple-issues@main
with:
  # label 'multiple issues' will be added
  comment: 'custom message'
  issueNumber: true
  gh-token: ${{ secrets.GITHUB_TOKEN }} # this is mandatory

Print a custom message without mentioning issue number
uses: Anmol-Baranwal/handle-multiple-issues@main
with:
  label: "multiple issues" #default
  comment: 'custom message'
  gh-token: ${{ secrets.GITHUB_TOKEN }} # this is mandatory

Multiline comment message with issue number
uses: Anmol-Baranwal/handle-multiple-issues@main
with:
  label: "multiple issues" #default
  comment: |
    custom message1
    custom message2
  issueNumber: true  #default is false
  gh-token: ${{ secrets.GITHUB_TOKEN }} # this is mandatory

#  Suppose #1 is already created by the author.
#  Output
#  #1 custom message1
#  custom message2

🤝 How to Contribute?

All changes are welcome. Please read our contributing guidelines

Feel free to suggest any features or report bugs using these issue templates.


📝 License


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

bullseye Tech & Tools

In case you want to run the action locally, without having to commit/push every time, you can use the act tool.


Author

Feel free to contact me if you need a custom workflow for your project. I'll be happy to build one.

GitHub Profile of Anmol Baranwal
Anmol Baranwal

@Anmol-Baranwal