forked from nf-core/modules
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (44 loc) · 1.57 KB
/
label-wishlist.yml
File metadata and controls
49 lines (44 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Label new module/subworkflow issues with wishlist if no assignee
on:
schedule:
- cron: "0 0 * * 0" # Once a week
workflow_dispatch:
jobs:
assign_label:
runs-on: ubuntu-latest
steps:
- name: Check Assignees and Add Labels
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
with:
github-token: ${{ github.token }}
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
// Get all open issues
const issues = await github.rest.issues.listForRepo({
owner,
repo,
state: "open",
per_page: 100
});
for (const issue of issues.data) {
// Skip pull requests
if (issue.pull_request) continue;
const assignees = issue.assignees;
const labels = issue.labels.map(label => label.name);
// Only add "wishlist" if no assignee and either new module or new subworkflow label is present
// and "wishlist" label is not already present
if (
assignees.length === 0 &&
labels.includes("new module") ||
labels.includes("new subworkflow") &&
!labels.includes("wishlist")
) {
await github.rest.issues.addLabels({
owner,
repo,
issue_number: issue.number,
labels: ["wishlist"]
});
}
}