Notify multiple issues 4505
Fixes #4505
What changes did you make?
- All Project Board related functions have been updated to align with ProjectV2
- Added
multiple-issue-reminder.mdfile - Modified
preliminary-update-comment.js:- Added functionality to check if the developer is assigned to another open issue. If so, the script will:
- Post a comment using the template message in
multiple-issue-reminder.md - Unassign the dev from the issue
- Add a "ready for dev lead" label
- Move the issue to the "New Issue Approval" column for dev leads to reprioritize
- Post a comment using the template message in
- The code exempt any developer who is part of Admin or Merge teams
- The code exempt any other issue that applies the following conditions:
- Any issues with label "Complexity: Prework"
- Any Agenda issues
- Any issues in the "Emergent Requests" or "New Issue Approval" columns
- Refactored existing code:
- Split the code into distinct functions to improve readability and maintainability.
- Added functionality to check if the developer is assigned to another open issue. If so, the script will:
Why did you make the changes (we will use this info to test)?
- Ensuring developers are not assigned to multiple issues simultaneously helps maintain focus on a single task and allows other developers to find available issues to work on.
Screenshots of Proposed Changes Of The Website (if any, please do not screen shot code changes)
No visual changes
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 moazDev1-notify-multiple-issues-4505 gh-pages
git pull https://github.com/moazDev1/website.git notify-multiple-issues-4505
availability: upcoming week, 6/10-16 eta: 6/16 e.o.d.
Hi @moazDev1 - I know you are working on this currently. Take your time!
This is a summary of what is going on with the migration, etc. and is from our previous conversation on Slack 6/17/24: You might have seen the Sunset Notice on the Project Board. GitHub is discontinuing Projects (classic) and before August Hack for LA needs to migrate to the Projects Beta. After talking with Bonnie and the team, doing some testing, and checking the calendar, we have decided that the Website is going to migrate to the new Projects Beta on Monday, June 24th.
Sorry for the short notice- this is happening very quickly. Each of you have currently submitted a PR that involves GitHub Actions and wanted to let you know that we will need to hold off merging any new GHAs until after the migration. To make this interesting, also need to let you know that after migration, any of the existing API calls using a ‘column’ reference will no longer work because Projects Beta is not structured the same- the new term is ‘status’ and it is not interchangeable. Some other REST API endpoints that will be deprecated soon are here.
So for all of you, after migration your workflows will need to be tested using Projects Beta. If you already installed Projects (classic) on your repo you can migrate to Projects Beta for early testing. (FYI after migrating you can reopen Projects (classic)- but do that immediately if you want to keep it because that option disappeared for me after a day.)
For any workflows that currently involve moving an issue to or from a ‘column’, this should be doable using GraphQL, ProjectV2, and Status. (I have not done this yet- still learning!) And/or we can discuss other options.
Finally, one last thing I notice is that for all of you there are parts of your issue that overlap with the other two’s issues. As one example, all three of your issues include posting messages to a member’s “Pre-work Checklist”. Unfortunately, this should have been caught earlier so that each issue was worked on after the other was completed, so that you would not each have a different solution to the same problem. (I could also be wrong and maybe there will not be any conflicts.)
From 6/24 Slack Hey everyone- we have migrated to Projects Beta. As I mentioned before we made revisions to all workflows that previously involved 'columns' including removing all workflow jobs that used the alex-page automation since these no longer work. "Issue Trigger", "Pull Request Trigger", and "Schedule-Friday" plus related js files had the biggest changes.
Hey @t-will-gillis, I just updated my code to align with ProjectV2. I tested it using nektos/act and worked just fine. I tried to merge it to my forked repo to run it but not sure why it didn't run my workflow their. No errors appear.
Hey @moazDev1 Sounds good- I'll start looking at this over the next couple of days
Hey @t-will-gillis, thanks for your notices. I just fixed them.
-
This was not running for me initially due to a permissions problem. I believe that we need a new token with “project” and “repo” scopes- let me know if you agree. We can create the token and then it could be inserted around Line 66 of issue-trigger.yml: github-token: ${{ HACKFORLA_GRAPHQL_TOKEN }}
Yes, just added it and fixed the permission issue. I had to add it also in line 55. It seems we have to provide the token every time we use
actions/github-script@v7. -
multiple-issue-reminder.md needs to be attached to PR
Done, I didn't notice it was removed from the PR. My bad.
-
Around Line 218: the substituted string needs to be “issueAssignee” to match the .md files, so the comments show the assignee's name, eg: placeholderString: '${issueAssignee}',
Done
-
I also refactored the
memberOfAdminOrMergeTeamfunction. Seemed there was already a function with same job inutilsdirectory.
The code is now working perfectly in my forked repo. Thanks for your clarifications, they really helped me a lot.
Hey @t-will-gillis, thanks for notices.
-
Thanks for refactoring memberOfAdminOrMergeTeam() - just need to add the import statement at top ;-)
Sorry for this oversight, I usually work on a separate branch to test changes on my forked repo before integrating them here. I'll make sure to be more careful next time.
-
Also, I think this conditional should occur before assignee = await getLatestAssignee(); (no reason to check for latest assignee if shouldPost === false)
Done
-
Regarding the "try - catch" statements: I know that this is what we are supposed to do as developers, the argument being ...
I removed all the try/catch blocks, but I believe using
throw errorinstead ofconsole.logwill trigger the error in the GitHub Actions console as you wanted. I made athrow errorversion in this branch. Please let me know if this works for you, so I can apply the changes to this branch as well. I believe using try/catch will make it much easier to track the exact location of errors as our codebase grows. -
The workflow seems to change the status to "In progress (actively working)" in many instances when it definitely should not: ...
My bad, I tried to automate the process of changing status to "In progress" as many developers forgot to do it. I think I can fix this by adding another condition but I'll revert everything to the original state and remove it for now.
-
I notice that there is a lot of repeated code in the main() and makeComment() functions- these should be integrated.
I just removed
makeComment()and combined its functionality intocreateComment(). I also refactored themain()function so I don't use redundant code. ThemakeComment()function was meant to make comment but it was holding the whole old code making it really ambiguous and hard to refactor.
Hey @t-will-gillis I just added back try/catch blocks and removed the unnecessary token.
Thanks for upgrading my PR complexity, I appreciate it :)