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

Refactor add-label.js to use label-directory.json #7538

Merged

Conversation

t-will-gillis
Copy link
Member

@t-will-gillis t-will-gillis commented Sep 29, 2024

Fixes #7537

What changes did you make?

  • Added link to retrieve-label-directory module and new variable definitions to use labelId - Consolidating to .map(retrieve-label-directory)
  • Searched code for comments that reference the specific label names and replaced with more generic labels
  • Removed redundant console.log() statements
  • Refactored the retrieve-label-directory.js module to remove the for loop since the labels are iterated using the spread syntax. Also, reformatted so that labelData is generated with the first iteration only.

UPDATE 10/14/24:

  • In retrieve-label-directory.js, removed the variadic parameter and refactored for a single parameter
  • Same file, changed the name of labelRetrieveNames() --> retrieveLabelName() for consistency, and edited plurals to singulars

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

  • Edits so that the label directory is used instead of label names

Screenshots of Proposed Changes To The Website (if any, please do not include screenshots of code changes)

Notes for Testing

  • If you have not set up your local repo for testing, refer to Hack for LA's GitHub Actions (current revision), especially Tips 6, 7, and 8. Note! These tips were created for the previous GitHub Projects (classic) and are being updated for the new Projects Beta. Some additional notes:
    • When copying the Project Board, be sure to set yourself as the owner. You can rename the copy to "Project Board" or leave it.

    • After you make the copy, you will see an error message that says something to the effect that some workflows have failed to be created- you can safely ignore this message.

    • You will likely want to change the View to 'Board' to see that the status column names transferred correctly.

    • To match Hack for LA's Project Board's functionality, you may need to activate workflows by selecting the three dots in the upper right, then "Workflows". Set the "Workflows" as follows:

      Screenshot 2024-10-02 143752
    • You will want to create the labels in your repo as explained in Tip 8.

  • Create a testing branch in your repo.
  • In add-label.js, Please comment out Line 182 minimizeComments(commentsToBeMinimized);
  • There are some hard-coded values that are specific to the Hack for LA repo. I don't think that this will affect you when you are testing this. However...
  • If you run across any errors that you can not figure out quickly, please send me a message. I might know what the problem is and can save you a lot of time troubleshooting.

Copy link

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-refactor-add-label-7537 gh-pages
git pull https://github.com/t-will-gillis/website.git refactor-add-label-7537

@github-actions github-actions bot added role: back end/devOps Tasks for back-end developers Complexity: Large Feature: Refactor GHA Refactoring GitHub actions to fit latest architectural norms size: 5pt Can be done in 19-30 hours labels Sep 29, 2024
@t-will-gillis
Copy link
Member Author

Hey @tamara-snyder and @codyyjxn Before you get too far reviewing this issue, I want to provide instructions for reviewing the PR, hopefully in the next day or two. Thanks!

@codyyjxn
Copy link
Member

codyyjxn commented Oct 1, 2024 via email

@mrodz
Copy link
Member

mrodz commented Oct 1, 2024

Hi @t-will-gillis, I hope you are well. Is it okay if I review this PR too? I can get you a review by EOD Wednesday, 10/2.

@t-will-gillis
Copy link
Member Author

Hey @mrodz Yes, definitely! Thank you

@mrodz mrodz self-requested a review October 2, 2024 22:51
@t-will-gillis
Copy link
Member Author

Hey @tamara-snyder, @codyyjxn, and @mrodz: I believe this is ready for review now. I added review notes, and I had to make some last-minute edits because I omitted some labels.

As I said in the review notes, let me know if you run into any problems that you can not figure out quickly- I might know what the problem is and could save you a lot of headaches. Thanks!

changed note to `labelKeys` from `labelIds`
codyyjxn
codyyjxn previously approved these changes Oct 8, 2024
Copy link
Member

@codyyjxn codyyjxn 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 Great Job refactoring the labels.

  • After reviewing this the way you refactored the label-directory.js it seems like that was a great approach of retrieving the label names.
  • Also the add-label.js is returning the correct labels that you added. You also map through them correctly.
  • The branch is correctly named the issue is linked.

The only thing I recommend is changing the original issue from "New issue approval" to "Working in progress"

Also thank you for the notes on reviewing the issue. It definitely helped me understand how to go about it.

Keep it up!

@tamara-snyder
Copy link
Member

Sorry for the delay! Thanks @t-will-gillis for adding some notes. I'll take a look at it today and come to office hours or reach out if I get stuck.
Review ETA: Friday, Oct 11
Availability: Afternoon Oct 10

@tamara-snyder
Copy link
Member

tamara-snyder commented Oct 12, 2024

Hi again @t-will-gillis, I got my environment set up (I think), but I haven't had time to test the issue yet. I'm travelling for the next few days, so I'm going to unassign myself from reviewing this just so it doesn't get held up. If it still needs a review when I return, I'll come back and look at it more. Thanks!

@tamara-snyder tamara-snyder removed their request for review October 12, 2024 00:56
mrodz
mrodz previously approved these changes Oct 12, 2024
Copy link
Member

@mrodz mrodz left a 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! This pull request looks good—your changes look sound, and the updated comments reflect your migration from hardcoded labels to runtime assignment.

The only thing I will note is that it is not super intuitive to have labelRetrieveNames be a variadic function if it always expects a single label parameter and does not do bounds checking for zero labels passed to labelKeys. But this could be intended behavior and open the door for future implementations—I'd like to hear your thoughts.

Testing looks good! Thanks for including your own test run and steps for others to follow suit.

Please let me know if there is anything else you need from me. I apologize for the delay—work and school have been very consuming. I hope you're having a wonderful day :)

@t-will-gillis
Copy link
Member Author

Hi @codyyjxn thank you for your review and comments. I corrected the issue status as you noted

Refactored non-variatic funct, renamed  funct
@t-will-gillis t-will-gillis dismissed stale reviews from mrodz and codyyjxn via 22ffe10 October 14, 2024 20:28
fix comments for singular use
@t-will-gillis
Copy link
Member Author

Hey @mrodz Thank you for your review comments. Argh, you are correct about the variadic function- I overlooked this. Since .map() is an iterative method, labelRetrieveNames() is never passed variadic arguments.

Thank you for pointing this out! I have edited the PR to remove the variadic, renamed the function labelRetrieveNames() --> retrieveLabelName() for consistency, and revised labelKeys --> labelKey, labelNames --> labelName, etc.

add comment first line, remove space
Copy link
Member

@codyyjxn codyyjxn left a comment

Choose a reason for hiding this comment

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

@t-will-gillis
The changes look good!
The code runs on my environment.
Great job on this!

@t-will-gillis t-will-gillis merged commit f425c4c into hackforla:gh-pages Oct 19, 2024
3 checks passed
@t-will-gillis t-will-gillis deleted the refactor-add-label-7537 branch October 19, 2024 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complexity: Large Feature: Refactor GHA Refactoring GitHub actions to fit latest architectural norms role: back end/devOps Tasks for back-end developers size: 5pt Can be done in 19-30 hours
Projects
Development

Successfully merging this pull request may close these issues.

Refactor GHA add-label.js to use label-directory.json
4 participants