Skip to content

Commit f8e9e5b

Browse files
authored
Merge branch 'main' into fix/issue-1350
2 parents 13fab58 + 55e1e0a commit f8e9e5b

File tree

7 files changed

+43
-12
lines changed

7 files changed

+43
-12
lines changed

.github/scripts/helpers/api.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,12 @@ async function resolveLinkedIssue(botContext) {
554554
}
555555

556556
if (issueNumbers.length === 1) {
557-
return await fetchIssue(botContext, issueNumbers[0]) || null;
557+
const issue = await fetchIssue(botContext, issueNumbers[0]);
558+
if (!issue || SKILL_HIERARCHY.findIndex(level => hasLabel(issue, level)) === -1) {
559+
getLogger().log('Single linked issue has no skill label', { issueNumber: issueNumbers[0] });
560+
return null;
561+
}
562+
return issue;
558563
}
559564

560565
const issues = await Promise.all(
@@ -573,6 +578,12 @@ async function resolveLinkedIssue(botContext) {
573578
return currIndex > bestIndex ? issue : best;
574579
});
575580

581+
const selectedIndex = SKILL_HIERARCHY.findIndex(level => hasLabel(selected, level));
582+
if (selectedIndex === -1) {
583+
getLogger().log('No linked issues have a skill label', { issueNumbers });
584+
return null;
585+
}
586+
576587
getLogger().log('Multiple linked issues found (using highest level)', {
577588
issueNumbers,
578589
selected: selected.number,

.github/scripts/tests/test-api.js

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,9 @@ const unitTests = [
404404
},
405405
},
406406
{
407-
name: 'resolveLinkedIssue: single linked issue → returns it',
407+
name: 'resolveLinkedIssue: single linked issue with skill label → returns it',
408408
test: async () => {
409-
const issueData = { number: 10, title: 'Fix bug', labels: [] };
409+
const issueData = { number: 10, title: 'Fix bug', labels: [{ name: LABELS.BEGINNER }] };
410410
const { botContext } = createMockBotContext({
411411
graphql: async () => ({
412412
repository: {
@@ -422,7 +422,28 @@ const unitTests = [
422422
},
423423
},
424424
{
425-
name: 'resolveLinkedIssue: multiple linked issues → returns highest skill level',
425+
name: 'resolveLinkedIssue: single linked issue with no skill label → returns null',
426+
test: async () => {
427+
const { botContext } = createMockBotContext({
428+
graphql: async () => ({
429+
repository: {
430+
pullRequest: {
431+
closingIssuesReferences: {
432+
nodes: [{ number: 7 }],
433+
},
434+
},
435+
},
436+
}),
437+
issues: {
438+
7: { number: 7, title: 'Issue 7', labels: [{ name: 'bug' }] },
439+
},
440+
});
441+
const result = await resolveLinkedIssue(botContext);
442+
return result === null;
443+
},
444+
},
445+
{
446+
name: 'resolveLinkedIssue: multiple linked issues with skill label → returns highest skill level',
426447
test: async () => {
427448
const { botContext } = createMockBotContext({
428449
graphql: async () => ({
@@ -445,7 +466,7 @@ const unitTests = [
445466
},
446467
},
447468
{
448-
name: 'resolveLinkedIssue: multiple issues, none with skill label → returns first fetched issue',
469+
name: 'resolveLinkedIssue: multiple linked issues with no skill label → returns null',
449470
test: async () => {
450471
const { botContext } = createMockBotContext({
451472
graphql: async () => ({
@@ -463,8 +484,7 @@ const unitTests = [
463484
},
464485
});
465486
const result = await resolveLinkedIssue(botContext);
466-
// No skill labels — reduce stays on first, so issue 4
467-
return result !== null && result.number === 4;
487+
return result === null;
468488
},
469489
},
470490
{

.github/workflows/on-comment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
ref: ${{ github.event.repository.default_branch }}
5858

5959
- name: Run On-Comment Handler
60-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
60+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
6161
with:
6262
script: |
6363
const script = require('./.github/scripts/bot-on-comment.js');

.github/workflows/on-pr-close.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
ref: ${{ github.event.repository.default_branch }}
3434

3535
- name: Run PR Close Handler
36-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
36+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
3737
with:
3838
script: |
3939
const script = require('./.github/scripts/bot-on-pr-close.js');

.github/workflows/on-pr-update.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3535

3636
- name: Run Bot
37-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
37+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
3838
with:
3939
script: |
4040
const script = require('./.github/scripts/bot-on-pr-update.js');

.github/workflows/on-pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3737

3838
- name: Run Bot
39-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
39+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
4040
with:
4141
script: |
4242
const script = require('./.github/scripts/bot-on-pr-open.js');

.github/workflows/zxc-build-library.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ jobs:
182182
id: solo
183183
uses: hiero-ledger/hiero-solo-action@692b186bd2e4c8d46b9deb1c067dc6ddcf0abcd7 # v0.18.0
184184
with:
185-
soloVersion: v0.67.0
185+
soloVersion: v0.68.0
186186
installMirrorNode: true
187187
mirrorNodeVersion: v0.151.0
188188
hieroVersion: v0.72.0

0 commit comments

Comments
 (0)