Skip to content

Commit f5b2d78

Browse files
Improved Issue handling (#250)
Added two workflows. Adding WIP when a PR is opened and adding a fixed_but_not_released label when PRs are closed. Necessary since no second layer (develop) is present
1 parent f953e92 commit f5b2d78

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# .github/workflows/fixed-on-merge.yml
2+
name: Mark linked issues as fixed but not released
3+
4+
on:
5+
pull_request:
6+
types: [closed]
7+
8+
permissions:
9+
issues: write
10+
pull-requests: read
11+
12+
jobs:
13+
label-fixed:
14+
if: github.event.pull_request.merged == true
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Swap WIP → fixed but not released
18+
uses: actions/github-script@v7
19+
with:
20+
script: |
21+
const body = context.payload.pull_request.body || '';
22+
const issuePattern = /refs?\s+#(\d+)/gi;
23+
const matches = [...body.matchAll(issuePattern)];
24+
25+
if (matches.length === 0) {
26+
console.log('No linked issues found.');
27+
return;
28+
}
29+
30+
for (const match of matches) {
31+
const issueNumber = parseInt(match[1]);
32+
33+
// Remove WIP label (ignore error if it wasn't there)
34+
try {
35+
await github.rest.issues.removeLabel({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
issue_number: issueNumber,
39+
name: 'WIP'
40+
});
41+
} catch (e) {
42+
console.log(`WIP label not present on #${issueNumber}, skipping removal.`);
43+
}
44+
45+
// Add "fixed but not released" label
46+
await github.rest.issues.addLabels({
47+
owner: context.repo.owner,
48+
repo: context.repo.repo,
49+
issue_number: issueNumber,
50+
labels: ['fixed but not released']
51+
});
52+
53+
console.log(`Updated issue #${issueNumber}: WIP → fixed but not released`);
54+
}

.github/workflows/wip_on_ref.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# .github/workflows/wip-on-ref.yml
2+
name: Label linked issues as WIP
3+
4+
on:
5+
pull_request:
6+
types: [opened, edited, synchronize]
7+
8+
permissions:
9+
issues: write
10+
pull-requests: read
11+
12+
jobs:
13+
label-wip:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Add WIP label to linked issues
17+
uses: actions/github-script@v7
18+
with:
19+
script: |
20+
const body = context.payload.pull_request.body || '';
21+
const issuePattern = /refs?\s+#(\d+)/gi;
22+
const matches = [...body.matchAll(issuePattern)];
23+
24+
if (matches.length === 0) {
25+
console.log('No linked issues found.');
26+
return;
27+
}
28+
29+
for (const match of matches) {
30+
const issueNumber = parseInt(match[1]);
31+
32+
// Add WIP label (issue stays open, just gets labelled)
33+
await github.rest.issues.addLabels({
34+
owner: context.repo.owner,
35+
repo: context.repo.repo,
36+
issue_number: issueNumber,
37+
labels: ['WIP']
38+
});
39+
40+
console.log(`Labelled issue #${issueNumber} as WIP`);
41+
}

0 commit comments

Comments
 (0)