Skip to content

Commit fa4e10b

Browse files
authored
Update post-to-skills-issue.js
Took `updateSkillsDirectory()` out of `if (!skillsInfo)` loop and added `needsUpdate` flag to trigger `updateSkillsDirectory()` after the MARKER comment is found
1 parent b74bae2 commit fa4e10b

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

github-actions/activity-trigger/post-to-skills-issue.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ async function postToSkillsIssue({github, context}, activity) {
3636
}
3737

3838
// Step 1: Try local directory lookup first
39+
let needsUpdate = false;
3940
let skillsInfo = lookupSkillsDirectory(eventActor);
4041

4142
if (!skillsInfo) {
@@ -46,9 +47,11 @@ async function postToSkillsIssue({github, context}, activity) {
4647

4748
// Step 3: Save result to local directory if found
4849
if (skillsInfo && skillsInfo.issueNum) {
49-
updateSkillsDirectory(eventActor, skillsInfo);
50+
needsUpdate = true
51+
} else {
52+
console.log(` ⮡ No Skills Issue found for ${eventActor}. Cannot post message.`);
53+
return;
5054
}
51-
}
5255

5356
// Get eventActor's Skills Issue number, nodeId, current statusId (all null if no Skills Issue found)
5457
//const skillsIssueNum = skillsInfo.issueNum;
@@ -93,7 +96,7 @@ async function postToSkillsIssue({github, context}, activity) {
9396
});
9497
console.log(` ⮡ Updated cached comment #${commentIdCached}`);
9598

96-
}else{
99+
} else {
97100
commentIdToUse = null;
98101
}
99102
} catch (err) {
@@ -156,12 +159,17 @@ async function postToSkillsIssue({github, context}, activity) {
156159
);
157160
console.log(` ⮡ Entry posted to Skills Issue #${skillsIssueNum}`);
158161
// Cache new comment ID
159-
updateSkillsDirectory(eventActor, { commentId: newComment.id });
162+
// updateSkillsDirectory(eventActor, { commentId: newComment.id });
160163
} catch (err) {
161164
console.error(` ⮡ Failed to create new comment for issue #${skillsIssueNum}:`, err);
162165
}
163166
}
164-
}
167+
168+
if (needsUpdate) {
169+
console.log(` ⮡ Updating Skills Directory for ${eventActor}...`);
170+
updateSkillsDirectory(eventActor, skillsIssueNum, skillsIssueNodeId, commentIdFound);
171+
};
172+
165173

166174
// Only proceed if Skills Issue message does not include: 'closed', 'assigned', or isArchived
167175
if (!(message.includes('closed') || message.includes('assigned') || isArchived)) {

0 commit comments

Comments
 (0)