Skip to content
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

Fix bug and consolidate "Schedule Thursday" into "Schedule Monthly" 4788 #5467

Merged
merged 37 commits into from
Dec 5, 2023

Conversation

t-will-gillis
Copy link
Member

@t-will-gillis t-will-gillis commented Sep 9, 2023

Fixes #4788

Notes to PR Reviewers

  • You will need to have a functioning test environment on your local repo. Here are additional changes that you should make to help with testing. If you do not make these edits, you might delete or mis-edit Hack for LA data, delete team members, generate false or junk notifications, and/or create junk issues on HfLA's live project board.
  • In the schedule-monthly.yml file:
    • Replace HfLA tokens with a personal token, 4 locations.
    • Make sure your personal token has a different name than HfLA's token
    • Line 12, redirect to your personal repo.
  • In contributors-data.js:
    • Lines 16-21, replace current with:
let oneMonthAgo = new Date();                        // oneMonthAgo instantiated with date of "today"
oneMonthAgo.setMonth(oneMonthAgo.getMonth() - 4);   // please make sure that the digit is set to '4'
oneMonthAgo = oneMonthAgo.toISOString();
let twoMonthsAgo = new Date();                        // twoMonthsAgo instantiated with date of "today"
twoMonthsAgo.setMonth(twoMonthsAgo.getMonth() - 5);  // please make sure that the digit is set to '5'
twoMonthsAgo = twoMonthsAgo.toISOString();
  • In create-new-issue.js:
    • Line 14, change "owner" to your personal repo
    • Lines 36-37, replace current with:
  let removedList = removeList.map(x => "@ " + x).join("\n");  // please make sure there is a space after "@  "
  let notifiedList = notifyList.map(x => "@ " + x).join("\n");  // please make sure there is a space after "@  "
  • In comment-issue.js:
    • Line 12, change the issue number to an issue in your personal repo
    • Line 18, change "owner" to your personal repo

Background

  • Referring to Fix bug that prevents GHA "Schedule Thursday 1100" from running #4768 also: Previously, both schedule-monthly.yml and schedule-thu-1100.yml have had bugs and have not run correctly for over a year. Both actions were intended to run once a month, and both involved listing inactive members and then performing some action with the list. For these reasons, we decided that these two should be consolidated into a single action.
  • 4768 started the consolidation by:
    • renaming the then-current "monthly" action as a temporary file named schedule-monthly-PREV.yml, then
    • renaming the then-current "Thursday" action as the refactored schedule-monthly.yml (and deleting the now-empty schedule-thu-1100.yml)
  • 4788 finishes the consolidation by:
    • incorporating the relevant sections of the "monthly-PREV" action into the refactored schedule-monthly.yml and deleting the now-empty temporary file.

What changes did you make?

  • The original get-list.ls from the original "Thursday" / renamed "monthly-PREV" action gathered a list of inactive members. However, its definition of 'inactive' was to mean that the member did not have an open issue at the exact time that the action checked. This is not very helpful information, therefore get-list.js is not used/ is deleted.
  • Instead, the definition of 'inactive' from trim-contributors.js file in the original "monthly" action is used. This file uses "true-github-contributors" from HfLA's "100 Automations" to search for activity and decide whether the member is active or not. UPDATE 11/12/23: This is incorrect. The original contributors-data.js file does import "true-github-contributors" from HfLA's "100 Automations"; however, on further review this automation is not actually used in the file and therefore the import is deleted. See notes from 10/29/23 below.
  • The remaining functionality in schedule-monthly-PREV.yml (i.e. other than get-list.js) has been integrated into the new, consolidated schedule-monthly.yml.
  • Changes included in the refactored schedule-monthly.yml:
    • Changed some capitalization and clarified some comments
    • Changed actions/checkout@v3 to actions/checkout@v4 per dependabot Bump actions/checkout from 3 to 4 #5443
    • Changed the name of the HfLA bot token line 18/19 to match the tokens in the remainder of the file
    • The remainder (lines 39 onward) incorporates the functionality from the original monthly issue by creating a new issue and adding a notification comment to an existing Dev Team issue.
    • Lines 39 onward are extended as new jobs on the GHA, and "artifacts" are used in order for the two jobs to share data
  • Changes to contributors-data.js:
    • Mostly changes to comments and jsDocs until line 250 onward. Here the list of inactive / removed members plus the list of members needing notification are saved to temp file in preparation for artifacting.
  • Changes to create-new-issue.js:
    • The main functionality is maintained, but the previous issue has been fleshed out to include "@-ing" the members and making a record of the removed and notified members on an issue.
    • (FUTURE: Optionally- the body of the issue could be pulled out into a markdown file.)
  • Changes to comment-issue.js: Besides edits to ensure the automation works, the changes are mainly to comments and formatting.

Why did you make the changes (we will use this info to test)?

  • In order to address the bugs and consolidate both automations into a single, functioning automation.

Screenshots of Proposed Changes

Diffchecker showing consolidation of `schedule-monthly.yml` functions

Screenshot 2023-09-12 103836
Screenshot 2023-09-12 103815
Screenshot 2023-09-12 103821

10/29/23: Additional changes

Per Bonnie's comments here and especially here:

  • in schedule-monthly.yml : bump actions/setup-node@v3 --> v4 per Bump actions/setup-node from 3 to 4 #5769
  • in contributors-data.js: removed reference to ‘trueContributorsMixin’ / ‘true-github-contributors’: This is not actually being used within the function.
  • In create-new-issue.js: added "thisIssuePredict" and "thisIssueNumber" to identify number of next issue prior to the issue being created
  • In create-new-issue.js: revised body, labels of “Review Inactive Members” <-- Major change
  • In create-new-issue.js: added milestone with correct reference to HfLA

11/22/23: Latest changes

Per Bonnie's comments here and discussion with Roslyn and Jessica:

  • in schedule-monthly.yml : bump actions/github-script@v6 --> v7 per Bump actions/github-script from 6 to 7 #5899
  • in contributors-data.js: when octokit.request() is run on "/issues", it returns only users who are "assignee"s. This is to avoid the problem discussed with Bonnie et al about the issue author considered as "active" when someone other than the author updates the issue.
  • in create-new-issue.js: added instructions to the "Review Inactive Team Members" issue a.) for members to respond with a comment, then reopen the issue and b.) for dev leads to follow a process to reinstall members, etc.
  • created a new workflow wr-schedule-monthly.yml that only runs if schedule-monthly.yml was successful, then automatically finds and closes the issue that was created.
  • See 11/29/23 below created a new workflow schedule-monthly-reopen.yml that is triggered when someone reopens the "Review Inactive Team Members" issue. The workflow moves the reopened issue to the "Questions / In Review" column and applies the ready for dev leads label.
  • Finally note that schedule-monthly-PREV.yml needs to be deleted immediately after merging this issue.

11/23/23: Addendum

Since we will be taking off for the month of December, this monthly check for inactive members should skip the January 1st run and resume on February 1st. Also, the February 1st run should remove members inactive since November 1st (3 months ago) since again, no December.

  • Edits made to schedule-monthly.yml and contributors-data.js to account for the December holiday.

11/29/23: Final Addendum

The remaining edits to this GHA address the problem of how to allow an inactive member (w/o write access) to create an issue to notify dev leads. The prev method was to create a new issue when the member commented; however as discussed this causes the GHA to run every time a comment is made on every issue. The new method is for the member to create a new issue themselves from the comment. Then when the issue is being created, it is picked up by the existing GHAs for issue creation and filtered/labelled appropriately.

  • Previous workflow schedule-monthly-reopen.yml is deleted/removed. It is no longer needed with the revisions.
  • Added new info to the "Review Inactive Team Members" issue per create-new-issue.js
  • Added filter functions to issue-trigger.yml to filter and label the new issue.

New issue created

  • As before, issue self-closes
  • Click on "Watch demo" for a visual demo.
  • See the comment on this issue
    Issue created by member in comment
  • Issue is labelled and sorted to Questions/In Review
  • Any member can do this- does not req write access

Log for revised Schedule Monthly
Log for new WR Schedule Monthly
Log for new issue

Combining functionalities of prev. `schedule-monthly.yml` and `schedule-thu-1100.yml`
Consolidate previous `schedule-monthly.yml` and `schedule-thu-1100.yml`
Consolidate `schedule-monthly.yml` and `schedule-thu-1100.yml`
@github-actions
Copy link

github-actions bot commented Sep 9, 2023

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.

git checkout -b t-will-gillis-fix-sch-monthly-4788 gh-pages
git pull https://github.com/t-will-gillis/website.git fix-sch-monthly-4788

@github-actions github-actions bot added Bug Something isn't working role: back end/devOps Tasks for back-end developers Complexity: Large time sensitive Needs to be worked on by a particular timeframe Feature: Board/GitHub Maintenance Project board maintenance that we have to do repeatedly Feature: Refactor GHA Refactoring GitHub actions to fit latest architectural norms size: 5pt Can be done in 19-30 hours labels Sep 9, 2023
@t-will-gillis t-will-gillis added the Draft Issue is still in the process of being created label Sep 9, 2023
@github-actions github-actions bot removed the Draft Issue is still in the process of being created label Sep 9, 2023
@t-will-gillis t-will-gillis changed the title Fix bug and consolidate "Schedule Monthly" and "Schedule Thursday" 4788 Fix bug and consolidate "Schedule Thursday" into "Schedule Monthly" 4788 Sep 9, 2023
@t-will-gillis t-will-gillis added the Draft Issue is still in the process of being created label Sep 10, 2023
@roslynwythe roslynwythe self-requested a review September 11, 2023 22:55
@roslynwythe
Copy link
Member

Availability: 9/12 noon - 2 pm
ETA: 9/13 EOD

@github-actions github-actions bot removed the Draft Issue is still in the process of being created label Sep 12, 2023
changed 'Website' team to 'website-write' team in the paragraph beginning "If this was a mistake..."
@roslynwythe
Copy link
Member

Hi @t-will-gillis I have a few questions:

  • I don't see any "Review Inactive Members" issues or comments in HfLA: Dev/PM Agenda and Notes #2607 referring to such issues. Were any such issues created in the process of testing ? When was the last time inactive members were deleted?
  • If I make the change suggested in contributors-data.js, to extend the deadlines by 1 month, do you expect any members to be deleted?

@t-will-gillis
Copy link
Member Author

t-will-gillis commented Sep 17, 2023

Hi @roslynwythe Thanks for reviewing and thanks for the questions:

  • For testing, I shifted both the creation and the comment/notification of the issue "Review Inactive Team Members" to my repo.
    • The test issue is here- my repo no. 326 and
    • I shifted the comment/ notification here- onto my repo no. 317.
    • Whenever I ran a test, the action actually did make real/ permanent changes to HfLA's 'website-write' team, as if this action was already live. At first, I mistakenly believed that tests would not causes any changes since I was running this from my own repo using my own token.
    • Because the test action does function, this is the reason I shifted the action dates back one month. The last tests I ran caused three-month inactive members to be removed from 'website-write'. The most recent is from my issue no. 326, September 8. (The GHA when live will remove two-month inactive members.)
  • If you extend the deadlines and run a test, there will likely be a few more 'three-month' inactive members- inactive since June 17th- removed from 'website-write'.
  • Side note: The member cnk was one of the early and productive contributors to the website. They are on the 'website-write' child team.
    • For some reason that I have not been able to identify, when I do test runs, the action cannot make changes to the child team. It might be because the test run is using my token, and since I don't have permission to edit the child team, my test run's token does not have permission either. (Maybe???)
    • After the action is live we will need to see if cnk persists in the child team.

@roslynwythe
Copy link
Member

Thank you @t-will-gillis for a super useful response. I'm afraid I'm not familar with these "Review of Inactive Member" issues and so I'm puzzled: For a member who has been removed from website-write, if there has been mistake or they want to come back, shouldn't they contact a dev lead immediately via Slack to be restored? I guess I'm unclear on how this "review" issue will work and so I don't understand the reason for the the instructions under "If it ihas been less than 20 days". Is the idea that the issue will remain open for 20 days to give members a chance to leave their comments, and then after 20 days I close it? Also I noticed the "ready for product" label. What is the role of product in this process?

Remove `ready for product` label
@t-will-gillis
Copy link
Member Author

Hi @roslynwythe - The intended function for the first of the two original GHAs was to create and post a list of the inactive members to the Monday Meeting Agenda. (I don't know the original reason- maybe to help with reviewing 2 weeks inactive issues?) The intended function for the second of the two original GHAs was to find inactive members and cut them from 'website-write'. Neither of the two original issues notified the inactive members.

For this revised/consolidated GHA, Bonnie wants to notify members when the bot determines that they have been inactive for over one-month, so that they know they're on the list to be cut from the website-write team. Then if the members are still inactive after two months the bot will proceed with removing them from 'website-write'.

The -message- of the issue comes from Bonnie. I believe she intends that eventually this message will be posted to the individuals' personal, progress-summary issues, when we implement those. So for the future, the bot will write this message as a comment onto an individual's issue, and then the individual can choose to respond or not. (This is how I understand it, but I could also be wrong.)

As I noted above, one of the original GHAs was supposed to post an issue on the board with the list of inactive members. This new "Review Inactive Team Members" issue extends the original by not only listing the inactive members but also "@-ing" them so that they are flagged with the message. The new issue also lists the two-month inactive members who were removed.

Regarding the notes for "if it has been less than (/more than) 20 days": My thought is that the "Review Inactive Team Members" issue would remain open for 30 days, until the next month's update. (*** See note below) So although the issue says 20 days, the one-month inactive member has the next 30 days to perform any kind of activity, such as by commenting, by picking up a new issue, or anything else. If they do, then the bot won't list them as 'inactive' the following month.

If the member is on the list of 'one-month inactive' members this month, and they do nothing, then the following month when the bot runs again the member will be on the 'two-month inactive' list, so they will be cut from website-write. Again the message says "over 20 days" but they really have 30 days. If a member has been cut from website-write for any reason then the member will need to Slack a dev lead to get added back in.

Regarding the Ready for product label, this is a holdover from the original GHA, but you are right it doesn't need this label. I will remove this label now.

***Note from above. The unanswered question: what are the reasons for the dev leads and Bonnie to receive this list of inactive members, besides "it-is-always-nice-to-know"? The bot automatically cuts the 'two-month inactive' members from 'website-write', however the issue itself says that "If we don't hear back from you in the upcoming weeks, we will unassign you from any issues you may be working on..." So to me it seems like late in the month, someone would want to take this list and do a quick search to see if these members have any open issues, and if so, manually remove those members and reprioritize their issues. (There probably is a way to have the bot unassign inactive members but to me it seems like this would be better as a manual activity.)

@mademarc
Copy link
Member

Review ETA: 11/22/2023
Availability: 7:46PM

mademarc
mademarc previously approved these changes Nov 23, 2023
Copy link
Member

@mademarc mademarc left a 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 i like how you made this code readable along with the proper changes to fix bug in order to make the code work.

updating actions/github-script@v6 --> v7 per hackforla#5899
Adding check to skip run on January 1st (since December is off for HfLA website)
Adding checks to skip the January 1st run, and adjust to 3 months inactive only for the February 1st run
Corrected the name of the GH_TOKEN
Corrected name of repo-token
latest updates for Inactive Members
The reopening mechanism will be different; this workflow no longer needed
latest with new mechanism for inactive members to create issues
new mechanism for inactive members to send message
@t-will-gillis
Copy link
Member Author

@ExperimentsInHonesty @roslynwythe
Final comments at top under "11/29/23 Final Addendum" (fingers crossed)

Demo video slowed down
f. ER#4541: add check to see if inactive member on 'website' team prior to removal from 'website-write' team
uploaded new demo gif
Copy link
Member

@roslynwythe roslynwythe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @t-will-gillis for completing work on this complex issue.

@roslynwythe roslynwythe merged commit 2fc0c93 into hackforla:gh-pages Dec 5, 2023
4 checks passed
@t-will-gillis t-will-gillis deleted the fix-sch-monthly-4788 branch December 5, 2023 02:40
t-will-gillis added a commit to t-will-gillis/website that referenced this pull request Dec 5, 2023
Delete obsolete file, functionality incorporated in hackforla#5467
t-will-gillis added a commit that referenced this pull request Dec 6, 2023
Delete obsolete file, functionality incorporated in #5467
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Complexity: Extra Large Feature: Board/GitHub Maintenance Project board maintenance that we have to do repeatedly Feature: Refactor GHA Refactoring GitHub actions to fit latest architectural norms role: back end/devOps Tasks for back-end developers size: 8pt Can be done in 31-48 hours time sensitive Needs to be worked on by a particular timeframe
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix bug that prevents GHA "Schedule Monthly" from running
6 participants