GitHub Action
Handle Multiple Issues
โน๏ธ This GitHub workflow is designed for open source projects where users are allowed to work on only one issue at a time.
With this GitHub workflow, you can automate tasks whenever an author creates multiple open issues.
- The workflow can comment the issues that are already created by the author which are currently in the open state.
- You can also filter the issues that are assigned to the author of the issue
- You can add your own comment message (even multiline) in the issue.
- You can add label or labels based on your preferences.
- Optionally, you can also close the issue (previous issues won't be affected), and only the current issue will be closed.
- You can ignore this workflow for specific users by using
ignoreUsers
- You can directly pass
ignoreCollaborators
- For custom configuration in-depth, you can check examples.
- Create a file in the repository at the following path:
.github/workflows/handle-multiple-issues.yml
and paste the following code into it.
name: Handle Multiple Issues
on:
issues:
types:
- reopened
- opened
jobs:
handle-multiple-issues:
runs-on: ubuntu-latest
steps:
- name: Handle Multiple Issues
uses: Anmol-Baranwal/handle-multiple-issues@v1
with:
label: "multiple issues" #default
close: false #default
issueNumber: true #default is true
Various inputs are defined to let you configure the action:
Name | Description | Default |
---|---|---|
gh-token |
The GitHub token for authentication | '${{ github.token }}' |
label |
Add a label to the current issue. Use commas to separate if there are multiple labels. | '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 | 'true' |
assign |
This will filter the issues that are assigned to the author (works only if issueNumber is true ) |
'false' |
ignoreUsers |
Specify usernames that should be ignored while running this workflow. Use commas to separate if there are multiple users. | '' |
ignoreCollaborators |
This will ignore all the collaborators in the repository while running this workflow | 'false' |
The Combinations that you can use with comment
, assign
and issueNumber
:
Suppose, a user has created
#1
,#2
which are currently open, only#2
is assigned to author and we have now included this workflow. Now suppose he creates the#3
issue.
You can see the examples for better clarity.
issueNumber | comment | assign | Purpose | Message by Bot |
---|---|---|---|---|
true |
false |
To mention issue number with the default message | #2, #1 is already opened by you |
|
true |
custom_message |
false |
To mention issue number with a custom message | #2, #1 custom_message |
false |
custom_message |
false |
Custom message without mentioning issue | custom_message |
false |
false |
Nothing is mentioned; only the label is added as per the workflow | ||
true |
true |
To filter issues that are created by the author and assigned to the same author | #2 has been opened by you and is also assigned to you. |
Only the default message is modified when
assign
is set totrue
; the concept of a custom message remains unchanged.
Add a custom label and print the issue number with a default message
uses: Anmol-Baranwal/handle-multiple-issues@v1
with:
label: "up for grabs" #default is 'multiple issues'
close: false #default
issueNumber: true #default is true
Add a default label and print the issue number with a custom message
uses: Anmol-Baranwal/handle-multiple-issues@v1
with:
# label 'multiple issues' will be added
comment: 'custom message'
issueNumber: true #default is true
Print a custom message without mentioning issue number
uses: Anmol-Baranwal/handle-multiple-issues@v1
with:
label: "multiple issues" #default
comment: 'custom message'
issueNumber: false #default is true
Multiline comment message with issue number
uses: Anmol-Baranwal/handle-multiple-issues@v1
with:
label: "multiple issues" #default
comment: |
custom message1
custom message2
issueNumber: true #default is true
# Suppose #1 is already created by the author.
# Output
# #1 custom message1
# custom message2
Add multiple labels
uses: Anmol-Baranwal/handle-multiple-issues@v1
with:
label: 'label1, label2' # separate using comma
issueNumber: true #default is true
To filter issues that are assigned to the author
- The same rules for message applies to this condition
- This will not work unless
issueNumber
istrue
.
uses: Anmol-Baranwal/handle-multiple-issues@v1
with:
issueNumber: true # default is true
assign: true # this will not work, unless 'issueNumber' is true
# Suppose #1, #2 is already created by the author. But only #2 is assigned to the author.
# Output
# #2 has been opened by you and is also assigned to you.
To ignore specified users while running this workflow
- Suppose, we have to ignore this workflow for users with username:
Anmol-Baranwal
,AnmolB2
.
uses: Anmol-Baranwal/handle-multiple-issues@v1
with:
issueNumber: true # default is true
ignoreUsers: 'Anmol-Baranwal, AnmolB2'
# Suppose Anmol-Baranwal created an issue. You will receive a log message during the workflow execution.
# Log Message
# User: Anmol-Baranwal is on the ignore list. Ignoring the workflow for this user.
To ignore collaborators of the repository while running this workflow
- Suppose, we have to ignore this workflow for users with username:
Anmol-Baranwal
,AnmolB2
.
uses: Anmol-Baranwal/handle-multiple-issues@v1
with:
issueNumber: true # default is true
ignoreCollaborators: true
# Suppose Anmol-Baranwal created an issue and is a collaborator. You will receive a log message during the workflow execution.
# Log Message
# User: Anmol-Baranwal is a collaborator. Ignoring the issue for collaborators.
All changes are welcome. Please read our contributing guidelines
Feel free to suggest any features or report bugs using these issue templates.
The scripts and documentation in this project are released under the MIT License. |
In case you want to run the action locally, without having to commit/push every time, you can use the act tool.
Feel free to contact me if you need a custom workflow for your project. I'll be happy to build one.
|