-
-
Notifications
You must be signed in to change notification settings - Fork 845
Enhanced Skills Activity GHA to use Skills Directory #8370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gh-pages
Are you sure you want to change the base?
Enhanced Skills Activity GHA to use Skills Directory #8370
Conversation
…ng back to original state
|
Want to review this pull request? Take a look at this documentation for a step by step guide! From your project repository, check out a new branch and test the changes. |
|
Hi @xnealcarson, I'll give this a review as well! ETA 10/17, generally able to be available 1-5p weekdays. |
|
Hey @xnealcarson, thanks for taking this issue! It looks like you're on the right track, and also great job on the PR description -- it made it easy to understand what you've done here. I noticed a couple things in my review:
Again, really nice work! Looking forward to seeing the next rev 🚀 |
ryanfkeller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, but a few things I think need attention! See my comment above.
|
Thanks for the check-in @DDVVPP. I just picked up last night where I left off, after getting a bit sidetracked this past week. I really let time get ahead of me. I'm about wrapped up with requested changes, save for a couple things, so I am not quite ready to send out those re-requests. I will check in again with another status update (hopefully the last!) tomorrow after 3pm PST. So sorry for the delay and thank your for your patience @ryanfkeller and @t-will-gillis. |
|
Ran into some issues working on the last of each of your requested changes, which I Slack'd @t-will-gillis about. He aims to assist me with those tomorrow, so I will give another follow-up then once I've received his feedback! |
|
Hey @xnealcarson Thanks and sorry for mixing up the function names. As I mentioned in Slack, the file I meant is I threw many function lookupSkillsDirectory(eventActor) {
const directory = loadDirectory();
console.log(``);
console.log(`At lookupSkillsDirectory() in skills-directory.js :`);
console.log(`eventActor: ${eventActor}`);
console.log(`directory[eventActor]: ${directory[eventActor]}`);
console.log(``);
const result = directory.find(entry => entry.eventActor === eventActor);
if (result) {
console.log(`result: ${JSON.stringify(result)}`);
console.log(`result["issueNum"]: ${result["issueNum"]}`); // just to verify
}
console.log(``);
console.log(`return 'result' rather than 'directory[eventActor]`);
console.log(``);
// return directory[eventActor] || null;
return result || null;If you sub these temporary log messages in, I think Thanks again for sticking with this! |
|
Hey @ryanfkeller and @t-will-gillis . My apologies for the delay in implementing your requested changes. I've just added Will's suggested changes for |
ryanfkeller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @xnealcarson, hopefully my inline comments in this review don't turn into a formatting mess! All my comments (and this) are IMO.
Overall I think this is a great update. I agree with all the changes you made re: my initial review -- especially nice work on the logic with the cached comment ID. I think that the logical flow of your code is solid and accomplishes the goal nicely (except for one off-nominal case where the comment at the cached comment ID doesn't have the marker).
There are a few placed where I think there are small coding errors, where maybe some stuff got accidentally deleted. I called out everything I saw, but it might be good to try re-running the tests once you solve them to see if you get good results.
There are also a couple places with nitpicks (like tab formatting & limiting console comments) that I'd like to see updated before merging.
Great work, thanks for sharing! Let me know if I missed anything or if you have any questions.
| function lookupSkillsDirectory(eventActor) { | ||
| const result = directory.find(entry => entry.eventActor === eventActor); | ||
| if (result) { | ||
| console.log(`result: ${JSON.stringify(result)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be good to clean up some of these console.logs to retain only what would be useful to someone looking at the logs. Since I think this will be called a lot AND we expect to regularly get both results existing and not existing, it might be better to not have prints here and let the caller code handle printing.
|
|
||
| const skillsStatusId = skillsInfo?.statusId || 'unknown'; | ||
| const isArchived = skillsInfo?.isArchived || false; | ||
| const commentFoundId = skillsInfo?.commentId || null; // not used currently |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be commentIdCached? This seems to be serving the purpose of commentIdCached, which is not initilized when it is used below.
| body: updatedBody, | ||
| }); | ||
| console.log(` ⮡ Updated cached comment #${commentIdCached}`); | ||
| return; // Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: are we good to end the function here, or do we still want to hit the block at the end where we potentially re-open the skills issue? If we want to hit that block, we'll need to remove the return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still interested in your thoughts on this one as well. My guess is that we would still want to hit the final if statement to potentially reopen the skills issue.
|
|
||
| // Find the comment that includes the MARKER text and append message | ||
| const commentFound = commentData.data.find(comment => comment.body.includes(MARKER)); | ||
| if (cachedComment && cachedComment.body.includes(MARKER)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't satisfy this if statement, I think we accidentally skip the fallback (because commendIdToUse is set to commendIdCached, which is non-null if we get here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment still applies. You could potentially resolve this by adding an else that sets commentIdToUse to null.
| // 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); | ||
|
|
||
| // Step 1: Try local directory lookup first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick but would be nice to have this indent on this comment match the code block
|
Hi @xnealcarson echoing what @ryanfkeller said- great work! Here are some comments in addition to Ryan's:
Thanks for working on this! Getting closer |
Added `const directory` back to, cleaned up logs in, and added closing bracket to `lookupSkillsDirectory`. Also added `const directory` to updateSkillsDirectory
|
|
||
| function updateSkillsDirectory(eventActor, skillsInfo) { | ||
| const directory = loadDirectory(); | ||
| const result = directory.find(entry => entry.eventActor === eventActor); |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @xnealcarson, in response to your comment, I think this CodeQL scan is about result, not directory. This function doesn't use the result that is collected. That makes sense to me, because this function is basically overwriting the entry that would have been found for result, right?
It seems to me like you can just delete the result line.
changed `commentFoundId` variable on line 58 to `commentIdCached`
|
Hey @ryanfkeller and @t-will-gillis ! Sorry for the delay and many thanks for the detailed feedback. I did find your inline comments to be very helpful @ryanfkeller, along with your supporting comments @t-will-gillis. We seem to be getting closer to wrapping up indeed with the changes I've made. As I'm writing this comment though, I see the CodeQL alert about the unused Other than that though, I will be on the lookout for any further suggestions you may have. Thanks again to both of your for your patience and help with this issue!! |
ryanfkeller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @xnealcarson, again, nice work! You knocked out most of my comments, and I marked those as resolved. There are two that I think still apply -- I added sub-comments and left them open. Finally, I think the last CodeQL warning is accurate and I left a comment on that.
Once those are set, I'd be really interested in seeing a last test run using your test infra just to make sure it's all still working the way we expect.
This is looking super close! Thanks for sharing!
|
|
||
| // Find the comment that includes the MARKER text and append message | ||
| const commentFound = commentData.data.find(comment => comment.body.includes(MARKER)); | ||
| if (cachedComment && cachedComment.body.includes(MARKER)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment still applies. You could potentially resolve this by adding an else that sets commentIdToUse to null.
| body: updatedBody, | ||
| }); | ||
| console.log(` ⮡ Updated cached comment #${commentIdCached}`); | ||
| return; // Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still interested in your thoughts on this one as well. My guess is that we would still want to hit the final if statement to potentially reopen the skills issue.
|
Hey @xnealcarson Here is a heads up before we talk on Zoom:
Again, thank you for keeping on this |
Changed lines 54 and 167 for testing latest changes to issue made in PR hackforla#8370
fixed typo on change made to line 54 for testing purposes
|
|
||
| // Get eventActor's Skills Issue number, nodeId, current statusId (all null if no Skills Issue found) | ||
| //const skillsIssueNum = skillsInfo.issueNum; | ||
| const skillsIssueNum = 17 |
Check notice
Code scanning / CodeQL
Semicolon insertion Note
the enclosing function
removed `return` on line 94 to hit block that re-opens issue & added `else` that sets `commentIdToUse` to `null`
Fixes #8316
What changes did you make?
github-actions/utils/_datafolder, and converted the directory to JSON format (skills-directory.json).utilsthat looks up in the directory and return the information (skills-directory.js).post-to-skills.jsfor the skills directorypost-to-skills-issue.jsto search the newly added skills directory before deferring to thequerySkillsIssue()GitHub API, if necessary, upon which new info found usingquerySkillsIssue()will be saved to the skills directoryWhy did you make the changes (we will use this info to test)?
CodeQL Alerts
After the PR has been submitted and the resulting GitHub actions/checks have been completed, developers should check the PR for CodeQL alert annotations.
Check the PR's comments. If present on your PR, the CodeQL alert looks similar as shown
Please let us know that you have checked for CodeQL alerts. Please do not dismiss alerts.
Instructions for resolving CodeQL alerts
If CodeQL alert/annotations appear, refer to How to Resolve CodeQL alerts.
In general, CodeQL alerts should be resolved prior to PR reviews and merging
Screenshots of Proposed Changes To The Website (if any, please do not include screenshots of code changes)
No visual changes to the website
NOTE TO REVIEWERS
If you would like to test these changes for yourself:
HACKFORLA_GRAPHQL_TOKENis activeactivity.trigger.ymlto refer to your own repo.github-actions/utils/_data/status-field-ids.js, so you will need to tell the bot the number of your repo's Skills Issue by making the following edits:post-to-skills-issue.js, change:post-to-skills-issue.jsto: