Creates GHA workflow to notify on deletion of in-use issue labels #8321
Creates GHA workflow to notify on deletion of in-use issue labels #8321t-will-gillis merged 8 commits intohackforla:gh-pagesfrom
Conversation
|
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. |
|
available: m-f after 6 |
There was a problem hiding this comment.
Hey @ryanfkeller this is fantastic! All the parts seem to be working smoothly: on label deletion, an issue is generated showing the label deleted, who deleted it, and the issues affected, then a comment to the 'deleter' is posted on the issue and the info is posted as a comment to the weekly agenda. Very nice.
Things I really like:
- the addition of the note "Auto-generated by Flag Issues With Deleted Labels workflow." I think we should start using this note in similar situations.
- separating out the agenda number. It's clean and clear. Again, this should be done for many similar situations
- the modularized util files
- adding a subfolder for
/templates/. Once again, this should be done to clean up some of the other workflows also - incidentally, a PR I am working on now has a helper function that is very similar to
get-la-timestamp.jsexcept it is converting any UST to PST/PDT as opposed to returning 'now' as yours is. Assuming your PR is merged first, I will likely try to combine both
Some requests for changes:
- For the agenda issue posting, one thing that Bonnie specifically mentioned to me is that she wants an error message if the agenda issue that the workflow is trying to post to has been closed. The reason is that sometimes we close an agenda issue when it becomes overloaded with comments, and then we replace it with a new one. Eg: 7859 is a replacement for a previous agenda. Otherwise, the comment will keep posting to the closed issue and we won't know.
- Please change
actions/checkout@v4toactions/checkout@v5 - Please change
actions/github-script@v7toactions/github-script@v8
(both updated last week) - Suggestion to add (escaped) backticks to the issue title, line 34 of
create-notification-issue.js, so the final title is formatted:title: `Review Needed - Label \`${labelName}\` Deleted`, - In the
flag-issues...ymlfile, could you add to the initial comment with a note that that workflow is triggered byupdate-label-directory.yml? Might be helpful to someone in the future.
Thanks for working on this! you obviously put a lot of time into it. I think there are some other questions I might have about how you did some thing, for example how you are using templateVars in create-notification-issue.js, and also see if you have other ideas.
This new workflow is called by Update Label Directory if a label is deleted, and creates a notification issue if the deleted label was applied to any other issues in the repo. It then posts a comment to the agenda issue linking to the notification and providing some high level details. If the agenda issue isn't present, the workflow will create a new issue notifying that the agenda issue is missing.
… Deletion workflow Includes some utility helper scripts
The post-to-agenda script will now create a new notification issue if the status issue is closed, in addition to if it is missing.
f05976c to
5a32d15
Compare
|
Hi @t-will-gillis -- thank you so much for the detailed review and kind words! I really appreciate your time and feedback. Based on your review feedback, I've made the following updates:
For testing these updates, I did the following:
Absolutely looking forward to making any other changes discovered, as needed. RE: I'll certainly be repeating info you saw/know, but just to be thorough, the premise of the template system I put in this PR is that I pass the following to my template helpers:
The "variable strings" can be literally any string. I went with JS-var-in-string style because I thought it made it easier to spot, but I could have just as easily made The RE: other ideas, I have a couple things I noticed as I went through that I'd be happy to chat about -- although you already mentioned several of them in your comment! Of course, I also made my whole GHA test environment and automated scripts that I'd be interested to get a temperature check on. Thanks! |
t-will-gillis
left a comment
There was a problem hiding this comment.
Hey @ryanfkeller Sorry for the delay re-reviewing.
- I did not catch this earlier, but on the main issue created and on the 'Error Posting to Agenda Issue...", could you add the labels: ['Complexity: Small', 'size: 0.5pt','Feature: Administrative','role: back end/devOps', 'Ready for product'] ?
- Minor thing, for the "Error Posting to Agenda Issue" add the backticks around the label name
Everything else looks great- thanks again!
For both the primary "Label Deletion Notification Issue" and the possible subsequent "Error Posting to Agenda Issue", added ['Complexity: Small', 'size: 0.5pt','Feature: Administrative','role: back end/devOps', 'Ready for product']
|
Got it! I made the changes you called out:
I updated the test script, re-ran the test cases, and updated the test result links in the PR description above. Thanks! |
t-will-gillis
left a comment
There was a problem hiding this comment.
Awesome- thanks @ryanfkeller for all your work on this!
Fixes #8185
What changes did you make?
High level description
Implementation details
flag-issues-unlabeled-after-deletion.ymlwith three steps:Get recently unlabeled issues: Uses GraphQL query to find issues that had the deleted label removed in the last 5 minutesCreate notification issue: Generates notification issue with label deletion details (only if issues were affected)Post to agenda: Posts to agenda issue or creates error notification if agenda posting failsupdate-label-directory.ymlto call the new workflow when labels are deletedpopulate-template.js)create-templated-issue.jsandpost-templated-comment.js)get-la-timestamp.js)Why did you make the changes (we will use this info to test)?
Testing Details
Testing was performed on my fork using a separate testing branch. The test branch comparison is here.
Test setup changes (not in this PR)
Automated Testing Infrastructure Details (for potential future use)
Testing Environment:
hfla_testbased on node:20-bullseye (for npm)docker compose upcalls. This was done so it would not interfere with normal docker usage.docker compose up --build -d hfla_testing. Future calls can omit the--buildflag and reuse the built image.jest.config.jsandpackage.jsonunder /docker/testing that gets copied to the root of the container on container launch for testing.docker exec hfla_testing npm run test, which runs the "test" script defined inpackage.json(aka, what is stored inpackage.testing.jsonuntil the container is built). This script runs tests based on thejest.config.jstest match.Test Scripts:
gh-helper.mjsas a general purpose helper for interfacing with the repo (making issues, checking labels, etc.)flag-issues-unlabeled-after-deletion.test.mjsas the specific script for this workflow. This test includes setting up the test scenario, then verifying the proper behavior. I will note that running/debugging with this script will result in ~10 new issues in your fork per run, although the script attempts to close all issues generated during the test.Test Evidence
Test Scenario 1: Nominal case with agenda issue open
test-label-A-{timestamp}to all 5 issues, then deleted label. Expected 1 notification + 1 agenda comment listing all five issuestest-label-B[0,1,2,3]-{timestamp}. Added B0 to issues [0,1], added B1 to issues [1,2,3], added B2 to issues [3,4]. Deleted labels B0, B1, and B3. Expected notifications from B0 and B1 deletions with their respective issues listed. Expected no notifications from B2 (not deleted during test) and B3 (unused)Test Scenario 2: Scenario case with agenda issue closed
Test Scenario 3: Scenario case with agenda issue missing
Results:
To my eye, all test scenarios produced the expected results. The new workflow correctly identified affected issues and created the appropriate notifications, both with and without an existing or open Agenda issue.
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)