Skip to content

Commit 7808465

Browse files
committed
feat: add support for triaged labels
resolves #2
1 parent 629145a commit 7808465

File tree

4 files changed

+30
-15
lines changed

4 files changed

+30
-15
lines changed

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,17 @@ jobs:
3131
3232
## Configuration
3333
34-
| Property | Required | Value |
35-
| ---------------- | -------- | ----------------------------------------------------------- |
36-
| `github-token` | Yes | A GitHub API token (`GITHUB_TOKEN` is available by default) |
37-
| `project` | Yes | The project being managed |
38-
| `auto-add` | No | If true, all new issues are added to the project |
39-
| `triage-column` | No | Column name for new, unassigned issues |
40-
| `triage-label` | No | Label to apply to new issues |
41-
| `todo-column` | No | Column name for triaged issues |
42-
| `working-column` | No | Column name for in-progress issues |
43-
| `done-column` | No | Column name for completed issues |
34+
| Property | Required | Value |
35+
| ---------------- | -------- | ----------------------------------------------------------------------------------------------- |
36+
| `github-token` | Yes | A GitHub API token (`GITHUB_TOKEN` is available by default) |
37+
| `project` | Yes | The project being managed |
38+
| `auto-add` | No | If true, all new issues are added to the project |
39+
| `triage-column` | No | Column name for new, unassigned issues |
40+
| `triage-label` | No | Label to apply to new issues |
41+
| `triaged-labels` | No | A comma separated list of labels; the presence of any of them marks an issue as already-triaged |
42+
| `todo-column` | No | Column name for triaged issues |
43+
| `working-column` | No | Column name for in-progress issues |
44+
| `done-column` | No | Column name for completed issues |
4445

4546
## How it works
4647

@@ -53,7 +54,8 @@ executed if that property is defined.
5354
Rules:
5455

5556
- If `auto-add` is true, new issues will be added to `triage-column` and have
56-
`triage-label` set
57+
`triage-label` set, unless an issue has a label in `triaged-labels`, in which
58+
case it will be moved to `todo-column`
5759
- Issues in `triage-column` will be moved to `todo-column` when `triage-label`
5860
is removed
5961
- Issues that are in `todo-column` or `triage-column` will be moved to

dist/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4445,8 +4445,9 @@ function main() {
44454445
switch (actionInfo.action) {
44464446
case types_1.Action.IssueOpened:
44474447
core_1.info(`Issue ${issue.number} was opened`);
4448-
if (issue.isAssigned()) {
4449-
core_1.info(`Issue ${issue.number} is assigned`);
4448+
if (issue.isAssigned() ||
4449+
config.triagedLabels.some((lbl) => issue.hasLabel(lbl))) {
4450+
core_1.info(`Issue ${issue.number} is assigned or has triage labels`);
44504451
if (config.workingColumnName) {
44514452
// If the issue is already assigned, move it to the working column
44524453
core_1.info(`Moving issue ${issue.number} to working column`);
@@ -25854,6 +25855,7 @@ function getAction(context) {
2585425855
}
2585525856
exports.getAction = getAction;
2585625857
function getConfig() {
25858+
const triagedLabels = core_1.getInput('triaged-labels');
2585725859
const config = {
2585825860
token: core_1.getInput('github-token'),
2585925861
projectName: core_1.getInput('project'),
@@ -25863,6 +25865,9 @@ function getConfig() {
2586325865
triageColumnName: core_1.getInput('triage-column'),
2586425866
// Label that will be applied to triage issues
2586525867
triageLabel: core_1.getInput('triage-label'),
25868+
// A comma separated list of labels that indicate that an issue has already
25869+
// been triaged
25870+
triagedLabels: triagedLabels ? triagedLabels.split(/\s*,\s*/) : [],
2586625871
// Column for "ready" issues
2586725872
todoColumnName: core_1.getInput('todo-column'),
2586825873
// Column for "in-progress" issues

src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ async function main() {
3030
case Action.IssueOpened:
3131
info(`Issue ${issue.number} was opened`);
3232

33-
if (issue.isAssigned()) {
34-
info(`Issue ${issue.number} is assigned`);
33+
if (
34+
issue.isAssigned() ||
35+
config.triagedLabels.some((lbl) => issue.hasLabel(lbl))
36+
) {
37+
info(`Issue ${issue.number} is assigned or has triage labels`);
3538

3639
if (config.workingColumnName) {
3740
// If the issue is already assigned, move it to the working column

src/init.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ export function getAction(
5353
}
5454

5555
export function getConfig() {
56+
const triagedLabels = getInput('triaged-labels');
57+
5658
const config = {
5759
token: getInput('github-token'),
5860
projectName: getInput('project'),
@@ -62,6 +64,9 @@ export function getConfig() {
6264
triageColumnName: getInput('triage-column'),
6365
// Label that will be applied to triage issues
6466
triageLabel: getInput('triage-label'),
67+
// A comma separated list of labels that indicate that an issue has already
68+
// been triaged
69+
triagedLabels: triagedLabels ? triagedLabels.split(/\s*,\s*/) : [],
6570
// Column for "ready" issues
6671
todoColumnName: getInput('todo-column'),
6772
// Column for "in-progress" issues

0 commit comments

Comments
 (0)