Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions github-actions/activity-trigger/post-to-skills-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
const checkTeamMembership = require('../utils/check-team-membership');
const statusFieldIds = require('../utils/_data/status-field-ids');
const mutateIssueStatus = require('../utils/mutate-issue-status');
const { lookupSkillsDirectory, updateSkillsDirectory } = require('../utils/skills-directory');

// `complexity0` refers `Complexity: Prework` label
const SKILLS_LABEL = retrieveLabelDirectory("complexity0");
Expand Down Expand Up @@ -33,13 +34,29 @@
console.log(`eventActor is undefined (likely a bot). Cannot post message...`);
return;
}

// Step 1: Try local directory lookup first
let skillsInfo = lookupSkillsDirectory(eventActor);

if (!skillsInfo) {
console.log(`No cached Skills Issue found for ${eventActor}, querying GitHub...`);

// Step 2: Fallback to GitHub API
skillsInfo = await querySkillsIssue(github, context, eventActor, SKILLS_LABEL);

// Step 3: Save result to local directory if found
if (skillsInfo && skillsInfo.issueNum) {
updateSkillsDirectory(eventActor, skillsInfo);
}
}


// Get eventActor's Skills Issue number, nodeId, current statusId (all null if no Skills Issue found)
const skillsInfo = await querySkillsIssue(github, context, eventActor, SKILLS_LABEL);
const skillsIssueNum = skillsInfo.issueNum;
const skillsIssueNodeId = skillsInfo.issueId;
const skillsStatusId = skillsInfo.statusId;
const isArchived = skillsInfo.isArchived;
const skillsInfo = await querySkillsIssue(github, context, eventActor, SKILLS_LABEL);
const skillsIssueNum = skillsInfo.issueNum;
const skillsIssueNodeId = skillsInfo.issueId;
const skillsStatusId = skillsInfo.statusId;
const isArchived = skillsInfo.isArchived;

// Return immediately if Skills Issue not found
if (!skillsIssueNum) {
Expand Down Expand Up @@ -97,7 +114,7 @@
if (!(message.includes('closed') || message.includes('assigned') || isArchived)) {

// If eventActor is team member, open issue and move to "In progress"
const isActiveMember = await checkTeamMembership(github, context, eventActor, TEAM);
const isActiveMember = await checkTeamMembership(github, context, eventActor, TEAM);

if (isActiveMember) {
try {
Expand All @@ -121,4 +138,4 @@

}

module.exports = postToSkillsIssue;
module.exports = postToSkillsIssue;
Loading
Loading