-
-
Notifications
You must be signed in to change notification settings - Fork 778
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
Consolidate functions in schedule-monthly.yml
5969
#6011
Consolidate functions in schedule-monthly.yml
5969
#6011
Conversation
up to line 145
up to line 207
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.
Note that CONTRIBUTING.md cannot previewed locally; rather it should be previewed at this URL:
|
Added semicolon per CodeQL no. 85
Rename functions: - getTimeline --> getEventTimeline - isTimelineOutdated --> isEventOutdated To differentiate from sim functs in `add-label.js`
ETA: 1/18/24 10am |
Edits to resolve merge conflict
rename `toRemove` --> `shouldRemoveOrNotify`
clarification of comment
incorporating comments from 1/5/24 dev meeting
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 @t-will-gillis!
Great job with GHA! It looks like it's functioning well!
- The branching was done correctly
- Issue number was linked
- The PR title is descriptive of the changes
- Changes were made correctly in the code
- Manual testing shows the comment is added correctly and the new issue is created correctly
- Results were accurate for notifying and removing members when randomly verified
- Relevant logs were included
- The PR request clearly states what was updated
- Additional testing instructions were included
I have a couple non-functional requests and a few questions about the intended functionality.
-
There is a missing closing bracket at the end of the file in
contributors-data.js
-
In line 190 of
contributors-data.js
theissueNum
parameter can be removed as it is not being used -
In the instructions for testing, for the changes in
github-actions/trigger-schedule/github-data/contributors-data.js
, I believe it's lines 285-291 not 273-279 that need to be replaced (probably changed after some edits). Might be helpful to update it, if we plan to wait on another review. -
On line 308 the API call for the user's repo could probably be simplified using this request
/repos/{owner}/website
and catching it if it doesn't exist, rather than looping through each repo. However, I also know that I have seen some folks who didn't use website as their cloned repo name. We may want to keep it as is and check every repo to see if it's parent's full_name ishackforla/website
instead of checking it by therepo
variable. I will leave it to you about how you want to address this. I think it's okay as it is, but it these could be marginal improvements. -
I'm assuming the 2 months becomes 3 months ago for February because December is a break month. Should we also do the same thing for January for the one month ago that is done for February or do we not care because its just an additional message and folks aren't getting removed?
-
Lines 321-330 seem at first glance to be redundant since maintainers are added to the allContributorsSince list at line 142. It looks like there is a separate role that is different from being added to the maintainer team. Is that something we should consider standardizing or is there circumstance where a user who has the maintainer role shouldn't be on the website-maintain team?
-
It would likely be helpful to add the list of inactive members with open issues so they can be handled appropriately either in the agenda page, the new issue, or an entirely new issue. Is there a plan to incorporate that list in some way?
-
It looks like the list to notify in the issue includes not only the people who have been inactive for a month, but also the people who have already been removed (inactive for more than 2 months). Bringing this up to make sure this is the intended behavior.
-
The issue outlines a procedure for temporary leaves. Are there plans to automate checking for temporary leaves to prevent removal? Or is the plan just to add them back when they return?
Future suggestions for refactoring and issues
I took some notes on some future refactoring and easy issues that could be created and thought I would include them here to get your thoughts. As you mentioned on Slack, there is definitely still a fair amount of refactoring that can be done.
- In
contributors-data.js
fetchContributors()
and the other longer functions could be refactored- Line 200 I agree this appears to be redundant
- The functions in
create-new-issue.js
could all be good utility functions. Arguments or context could be passed into main to replace template variables. - For calling the API in our GHAs, it looks like we are using octokit directly and actions/github-script that uses octokit indirectly and provides repo context as well. We might want to consider choosing one and sticking with it so that we can more easily refactor and create utilities. For example,
github-actions\utils\getTimeline.js
could be quickly swapped in for the getEventTimeline function in contributors-data.js. Right now it's possible to use it, but we would need to mimic the context object. - The context object (
context.repo.owner
context.repo.repo
) can be used instead of hardcoding theowner
andrepo
variables increate-new-issue.js
andcomment-issue.js
unless we want to move to octokit. - A standalone good first issue could be to delete line 1 and 2 in
comment-issue.js
Again, great work and thanks for taking the time to contribute and continuing to take on these GHAs!
ETA: Evenings |
First pass addressing PR review comments
Hey @LRenDO many, many thanks for your very thorough review and corresponding notes. Here are responses to the first part of your review- more to follow
OK that is all for now- I will continue in a separate comment with your suggestions for refactoring. |
`comment-issue` step replaced by refactoring
Extending the ETA: EOD 1/25/24, maybe a need to look through it a bit more and have clear understanding of the issue and GHA as well..... I hope it's not a |
Refactored to replace `comment-issue.js` with `post-issue-comment.js`
github-actions/trigger-schedule/list-inactive-members/create-new-issue.js
Fixed
Show resolved
Hide resolved
…issue.js refactored `comment-issue.js` with `/util/post-issue-comment.js`
Hey @LRenDO (and @freaky4wrld )! To extend what you are saying, the Also-
Marking ready for re-review. |
adding ";" per CodeQL recommendation
Hey @freaky4wrld - thanks for the update. Please feel free to message @LRenDO or me if there is anything we can help you with. |
Remove lastCommentTimestamp checks in isEventOutdated()
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 @t-will-gillis first of all hats-off for working on such an issue, and thanks for providing testing-guidance and bear with me throughout the procedure. Here you go with my review :
- The to/from branch are correct
- The linked issue is correct as well
- The changes suggested and done by you suits well as of my understanding of the issue
- Testing done manually was successful performing
automatic issue-creation
,identifying the inactive members
,notifying potential inactive members
andposting a comment linking the issue created
- Thanks for providing additional testing guide, the reason for making the changes was clear and specifying the location where changes are done
- In
contributor.js
the suggestion for providing correct value tooneMonthAgo
andtwoMonthAgo
was implemented correctly, thefetchContributors( )
function looks apt and produces correct results also the suggestion to use the format/repos/{owner}/website
in API call is implemented. - In the same file
getEventTimeline( )
maybe this a very minor change you can name thearra
variable to something descriptive liketimelineArray
it’s upto you the logic looks fine and working correctly. - The hard-coded variables and template is removed from
create-new-issue.js
and a new file with a descriptive and appropriate nameinactive-member.md
is created and fetched correctly to create a new issue - The
issue-template-parser.js
is correctly extracting the data and the template from theinactive-member.md
which is then used bycreate-new-issue.js
, nice idea for - The file
comment-issue.js
is replaced withpost-comment.js
which is working correctly in posting a comment and notifying the project leads about the issue created. - Lastly I would like to say you considered most of the edge cases, the rest can be considered and fixed in the future when the actions work weirdly (which it doesn’t do currently).
I guess that’s all from my side, at first I was overwhelmed by the scope of this issue but thanks @t-will-gillis and @LRenDO for guidance and providing resources to review this…..
There’s a lot to learn from you guys, PR approved……..
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 @t-will-gillis and @freaky4wrld!
@freaky4wrld, thanks for the kind words! As @t-will-gillis said, feel free to reach out! Always happy to help!
@t-will-gillis, thanks for clarifying all the things and great work on the updates! Everything is functioning correctly. I have one potential request to take a look at. The rest are responses and refactoring thoughts.
Potential Request:
- I might be thinking about this incorrectly. Maybe you can clarify it for me. In
contributors-data.js
, I believe the condition for theoneMonth
variable should be0
forJanuary
not1
forFebruary
. As it is now, when it checks in February,oneMonthAgo
causes it to look back 2 months to December. If I understood correctly, we are looking to skip December since most folks won't contribute that month. If we change itoneMonthAgo
to 2 months in January, it should look back to November which I believe is the behavior we are looking to create.
Other Stuff:
- Good catch on the refactoring to use post-comment!
- Totally lost track of the order of operations. You're absolutely right the reason the folks who were supposed to be removed were on the notified list was because they weren't actually removed for testing. Thanks for pointing it out!
- It is an excellent point to change the context variables of the util functions to repo and owner. Though if there were any other parameters that need to passed it could get start to get a bit cumbersome as most of those functions already have 4 parameters. We would still need github itself because it is the octokit we use to call the API, but we could maybe name it something more clear or add a clarifying comment. From what I can see, it doesn't look like
getTimeline
is actually being used. I think it could be a good medium, maybe large, issue swap outgetEventTimeline()
incontributor-data.js
forgetTimeline
, unless you want to take it on now. - On the topic of having a lot of parameters in some of the workflows, I think there is some room for refactoring and creating a class or two. For example a class for an API instance and we could abstract some of the calls to the API as well as have an easier way to pass the octokit and the context. Potentially, a comment class could be useful as well. This is definitely a bigger scope than this issue though.
Remove unnecessary variable on line 77
Hey @freaky4wrld and @LRenDO Thank you both for your thoughtful reviews and suggestions. Nayan- I agree about renaming Regarding I made another small change in Thanks so much again and let me know if there is anything else |
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.
@t-will-gillis, I missed the cron at the top of schedule-monthly and didn't realize it wasn't running in January. It all makes sense now. Thanks for taking the time to clarify! Yes, let's definitely chat about potentially designing a significant refactor for the GHAs.
Fixes #5969
What changes did you make?
inactive-members.md
markdown template to provide a more easily edited and maintainable template for the GHAschedule-monthly.yml
.issue-template-parser.js
to the/utils
folder to read and parse the template.create-new-issue.js
, removed the hard-coded data for creating a new issue and replaced with a call to the template parser.contributors-data.js
, addressed a bug whereby assignees were incorrectly considered as active whenever the bot commented. Fix is for activity to be counted only when the assignee causes the activity (for example, by commenting, etc.)contributors-data.js
, removed fs.readFile() at previous lines 287-291. This function's only purpose was to confirm that the fs.writeFile() was successful- it is no longer required.contributors-data.js
,addressed the requirement that team members with open issues are not removed from the "website-write" team: 60-70 team members currently are 'inactive' but are blocked from removal from the team b/c of open issues: the log file now lists these inactive members and the open issues they are assigned to.UPDATED: At dev meeting on 1/15/24, it was discussed that member activity should not consider the open "Pre-work Checklist" issues. Refer to Line 135.contributors-data.js
, refer to lines 13, 74-75, and 142-144.Why did you make the changes (we will use this info to test)?
Screenshots of Proposed Changes Of The Website (if any, please do not screen shot code changes)
No visual changes.
GHA logs in order to show reporting for inactive members who are blocked from team removal due to open issues.
Inactive Team Member issue created using the
inactive-members.md
template.Notes to PR Reviewers
schedule-monthly.yml
file:wr-schedule-monthly.yml
file:github-actions/trigger-schedule/github-data/contributors-data.js
:contributors-data.js
github-data/github-actions/trigger-schedule/list-inactive-members/create-new-issue.js
:Ingithub-data/github-actions/trigger-schedule/list-inactive-members/comment-issue.js
:UPDATED: In
create-new-issue.js
change "owner" to your personal repocan keepcontext.repo.owner
agendaIssueNum
to an existing issue in your personal repoIn
github-data/github-actions/trigger-schedule/list-inactive-members/inactive-members.md
:After doing the above, you can trigger
schedule-monthly.yml
manually. If the gha runs successfully, it will open -then immediately close- a new issue in your repo called "Review Inactive Team Members". It will also add a comment to the issue that you listed foragendaIssueNum
increate-new-issue.js
.