Skip to content

Commit 67cfc09

Browse files
docs: add input and examples with several other changes
1 parent b29d14b commit 67cfc09

File tree

1 file changed

+64
-22
lines changed

1 file changed

+64
-22
lines changed

README.md

Lines changed: 64 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
## Handle Multiple Issues
22

3-
> ℹ️ This GitHub workflow is designed for open source projects where users are allowed to create only one issue at a time.
3+
> ℹ️ This GitHub workflow is designed for open source projects where users are allowed to work on only one issue at a time.
44
55
With this GitHub workflow, you can automate tasks whenever an author creates multiple open issues.
66

77
### Use cases
88

99
- The workflow can comment the issues that are already created by the author which are currently in the open state.
10+
- You can also filter the issues that are assigned to you
1011
- You can add your own comment message (even multiline) in the issue.
11-
- Add a custom label on the issue.
12+
- You can add label or labels based on your preferences.
1213
- Optionally, you can also close the issue (previous issues won't be affected), and only the current issue will be closed.
1314

1415
---
1516

1617
### 🚀 Getting Started
1718

1819
- For custom configuration in-depth, you can check [examples](#examples).
20+
- Create a file in the repository at the following path: `.github/workflows/handle-multiple-issues.yml` and paste the following code into it.
1921

2022
```yml
23+
name: Handle Multiple Issues
24+
2125
on:
2226
issues:
2327
types:
@@ -32,8 +36,7 @@ jobs:
3236
with:
3337
label: "multiple issues" #default
3438
close: false #default
35-
issueNumber: true #default is false
36-
gh-token: ${{ secrets.GITHUB_TOKEN }} # this is mandatory
39+
issueNumber: true #default is true
3740
```
3841
3942
---
@@ -44,26 +47,30 @@ Various inputs are defined to let you configure the action:
4447
4548
| Name | Description | Default |
4649
| ---- | ----------- | ------- |
47-
| `gh-token` | The GitHub token for authentication | N/A |
48-
| `label` | A label to add if the conditions are fulfilled | `'multiple issues'` |
50+
| `gh-token` | The GitHub token for authentication | `'${{ github.token }}'` |
51+
| `label` | Add a label to the current issue. Use commas to separate if there are multiple labels. | `'multiple issues'` |
4952
| `comment` | A message to comment on the issue | `''` |
5053
| `close` | This will close the issue if set to true | `'false'` |
51-
| `issueNumber` | This will comment all the previous issues that are created by the author | `'potential-duplicate'` |
54+
| `issueNumber` | This will comment all the previous issues that are created by the author | `'true'` |
55+
| `assign` | This will filter the issues that are assigned to the author (works only if `issueNumber` is `true`) | `'false'` |
5256

5357
<br>
5458

55-
The four Combinations that you can use with comment and issueNumber:
59+
The Combinations that you can use with `comment`, `assign` and `issueNumber`:
5660

57-
> 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.
61+
> 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.
5862

5963
> You can see the [examples](#examples) for better clarity.
6064

61-
| issueNumber | comment | Purpose | Message by Bot |
62-
| ----------- | ------- | ------- | -------------- |
63-
| `true` | | To mention issue number with the default message | `#2, #1 is already opened by you` |
64-
| `true` | `custom_message` | To mention issue number with a custom message | `#2, #1 custom_message` |
65-
| `false` | `custom_message` | Custom message without mentioning issue | `custom_message` |
66-
| `false` | | Nothing is mentioned; only the label is added as per the workflow | |
65+
| issueNumber | comment | assign | Purpose | Message by Bot |
66+
| ----------- | ------- | ------ | ------- | -------------- |
67+
| `true` | | `false` | To mention issue number with the default message | `#2, #1 is already opened by you` |
68+
| `true` | `custom_message` | `false` | To mention issue number with a custom message | `#2, #1 custom_message` |
69+
| `false` | `custom_message` | `false` | Custom message without mentioning issue | `custom_message` |
70+
| `false` | | `false` | Nothing is mentioned; only the label is added as per the workflow | |
71+
| `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.` |
72+
73+
> Only the default message is modified when `assign` is set to `true`; the concept of a custom message remains unchanged.
6774

6875

6976
---
@@ -78,8 +85,7 @@ uses: Anmol-Baranwal/handle-multiple-issues@v1
7885
with:
7986
label: "up for grabs" #default is 'multiple issues'
8087
close: false #default
81-
issueNumber: true #default is false
82-
gh-token: ${{ secrets.GITHUB_TOKEN }}
88+
issueNumber: true #default is true
8389
```
8490

8591
</details>
@@ -94,8 +100,7 @@ uses: Anmol-Baranwal/handle-multiple-issues@v1
94100
with:
95101
# label 'multiple issues' will be added
96102
comment: 'custom message'
97-
issueNumber: true
98-
gh-token: ${{ secrets.GITHUB_TOKEN }} # this is mandatory
103+
issueNumber: true #default is true
99104
```
100105

101106
</details>
@@ -110,7 +115,7 @@ uses: Anmol-Baranwal/handle-multiple-issues@v1
110115
with:
111116
label: "multiple issues" #default
112117
comment: 'custom message'
113-
gh-token: ${{ secrets.GITHUB_TOKEN }} # this is mandatory
118+
issueNumber: false #default is true
114119
```
115120

116121
</details>
@@ -127,8 +132,7 @@ with:
127132
comment: |
128133
custom message1
129134
custom message2
130-
issueNumber: true #default is false
131-
gh-token: ${{ secrets.GITHUB_TOKEN }} # this is mandatory
135+
issueNumber: true #default is true
132136
133137
# Suppose #1 is already created by the author.
134138
# Output
@@ -138,6 +142,44 @@ with:
138142

139143
</details>
140144

145+
<br>
146+
147+
<details>
148+
<summary>Add multiple labels</summary>
149+
150+
```yml
151+
uses: Anmol-Baranwal/handle-multiple-issues@v1
152+
with:
153+
label: 'label1, label2' # separate using comma
154+
issueNumber: true #default is true
155+
```
156+
157+
</details>
158+
159+
<br>
160+
161+
<details>
162+
<summary>To filter issues that are assigned to the author</summary>
163+
164+
<br>
165+
166+
- The same rules for message applies to this condition
167+
- This will not work unless `issueNumber` is `true`.
168+
169+
170+
```yml
171+
uses: Anmol-Baranwal/handle-multiple-issues@v1
172+
with:
173+
issueNumber: true # default is true
174+
assign: true # this will not work, unless 'issueNumber' is true
175+
176+
# Suppose #1, #2 is already created by the author. But only #2 is assigned to the author.
177+
# Output
178+
# #2 has been opened by you and is also assigned to you.
179+
```
180+
181+
</details>
182+
141183
---
142184

143185
### 🤝 How to Contribute?

0 commit comments

Comments
 (0)