Skip to content

Commit fef0be1

Browse files
authored
add manually runnable retroactive labeling (GregTechCEu#3101)
1 parent 772a94b commit fef0be1

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

.github/workflows/manage-issue-labels.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
name: Issue Labels
33

44
on:
5+
workflow_dispatch:
6+
inputs:
7+
issue_body:
8+
description: "The issue body"
9+
required: false
10+
type: string
511
issues:
612
types: [opened]
713

@@ -18,10 +24,12 @@ jobs:
1824
template: [ 000-bug-report.yml, 001-feature-request.yml ]
1925
steps:
2026
- uses: actions/checkout@v4
27+
2128
- name: Parse issue form
2229
uses: stefanbuck/github-issue-parser@v3
2330
id: issue-parser
2431
with:
32+
issue-body: ${{ github.event.issue?.body ?? inputs.issue_body }}
2533
template-path: .github/ISSUE_TEMPLATE/${{ matrix.template }}
2634

2735
- name: Set labels based on mc-version field
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Manages labels on new issues
2+
name: Retroactively apply Issue Labels
3+
4+
on:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
label-all:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
issues: write # IDK if this is needed to run manage-issue-labels, but it doesn't hurt so
15+
actions: write
16+
steps:
17+
- name: Labelifier
18+
uses: actions/github-script@v7
19+
id: label-em
20+
with:
21+
script: |
22+
github.paginate(github.rest.issues.listForRepo, {
23+
owner: "GregTechCEu",
24+
repo: "GregTech-Modern",
25+
}).then((issues) => {
26+
// issues is an array of all issue objects
27+
issues.forEach((issue) => {
28+
if (issue.pull_request != undefined) {
29+
// if it's a pull request, skip it.
30+
return;
31+
}
32+
octokit.rest.actions.createWorkflowDispatch({
33+
owner: "GregTechCEu",
34+
repo: "GregTech-Modern",
35+
workflow_id: "manage-issue-labels",
36+
ref: ${{ github.ref }},
37+
inputs: {
38+
issue_number: issue.body
39+
}
40+
});
41+
});
42+
});

0 commit comments

Comments
 (0)