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 GHA sort-closed-issues.js to use label-directory.json #7530

Closed
10 tasks done
Tracked by #6454
t-will-gillis opened this issue Sep 28, 2024 · 13 comments · Fixed by #7729
Closed
10 tasks done
Tracked by #6454

Refactor GHA sort-closed-issues.js to use label-directory.json #7530

t-will-gillis opened this issue Sep 28, 2024 · 13 comments · Fixed by #7729
Assignees
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

Comments

@t-will-gillis
Copy link
Member

t-will-gillis commented Sep 28, 2024

Overview

We want to refactor the GHA workflows to reference each label by a general ID (i.e. a 'labelKey') rather than the label's name so that other HfLA project groups can use these workflows without needing to match the label names used by the Website team.

Details

Currently, the GHA workflows files that add, remove, and change labels on issues identify each label by its name (i.e. the 'labelName') directly. Instead of hard-coding each label name, we want these files to identify each label by its 'labelKey' and use the retrieve-label-directory.js module to look up the corresponding 'labelName' that is needed in order for the REST API to apply labels to issues.

Action Items

This issue involves the "Move Closed Issues" GitHub Action, and you must set up your environment for testing GHAs in order to work on this issue. See notes below in "Resources/ Instructions", and ask questions if you need additional help- GHAs can be tricky, and if you get stuck somewhere, someone who has worked on these before might have information that will save you a lot of time.

  • Before making any of the edits following, first create a test branch in your repo and demonstrate the current, correct behavior of the "Move Closed Issues" GHA. Afterwards, create an additional branch for the edits following- this is the branch that will be attached to the PR.

Refer to sort-closed-issues.js.

  • A preliminary search found that this file uses the following labels. As you work through this issue, confirm that this list is correct, and note any additions or subtractions as needed:

    • Feature: Refactor CSS
    • Feature: Refactor HTML
    • Feature: Refactor JS / Liquid
    • Feature: Refactor GHA
    • role: back end/devOps
    • Feature: Analytics
    • role: front end
  • Add to // Import modules:

    const retrieveLabelDirectory = require('../../utils/retrieve-label-directory');
    
  • Before the current definition of the hard labels around line 13, add comment:

    // Use labelKeys to retrieve current labelNames from directory
    

    then for each label, consult label-directory.json and replace labelName with the labelKey:

    const [
      featureRefactorCss,
      featureRefactorHtml,
      featureRefactorJsLiquid,
      featureRefactorGha,
      roleBackEndDevOps,
      featureAnalytics,
      roleFrontEnd
    ] = [
      “featureRefactorCss”,
      “featureRefactorHtml”, 
      “featureRefactorJsLiquid”,
      “featureRefactorGha”,
      “roleBackEndDevOps”,
      “featureAnalytics”,
      “roleFrontEnd”
    ].map(retrieveLabelDirectory);
    
  • Search sort-closed-issues.js for instances of the original label name and substitute the defined above.

  • Prior to submitting the PR, search sort-closed-issues.js for for all code comments that reference a specific label name

    • List these instances out in a comment on this issue, with your suggestion for replacement text that generalizes it.
    • When finished, add the label ready for product and change status to "Questions / In Review"
    • Product will review and provide feedback on replacement text for revision or sign-off on changes.
  • Perform a test in your own repo that demonstrates that there is no change to the GHA's functionality after making the edits.

Resources/Instructions

@t-will-gillis t-will-gillis added Complexity: Large Draft Issue is still in the process of being created 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 labels Sep 28, 2024
@t-will-gillis t-will-gillis added this to the 08. Team workflow milestone Sep 28, 2024
@t-will-gillis t-will-gillis self-assigned this Sep 28, 2024
@HackforLABot

This comment has been minimized.

@t-will-gillis t-will-gillis added Ready for Prioritization and removed Draft Issue is still in the process of being created labels Oct 7, 2024
@ExperimentsInHonesty

This comment was marked as outdated.

@ExperimentsInHonesty ExperimentsInHonesty added ready for dev lead Issues that tech leads or merge team members need to follow up on Added to dev/pm agenda and removed Ready for Prioritization labels Oct 8, 2024
@t-will-gillis t-will-gillis added Ready for Prioritization and removed ready for dev lead Issues that tech leads or merge team members need to follow up on labels Oct 14, 2024
@t-will-gillis t-will-gillis removed their assignment Oct 14, 2024
@aadilahmed aadilahmed self-assigned this Oct 31, 2024
@aadilahmed aadilahmed moved this from Prioritized backlog to In progress (actively working) in P: HfLA Website: Project Board Oct 31, 2024
@HackforLABot

This comment has been minimized.

@aadilahmed
Copy link
Member

i. Availability: 9 AM - 5 PM Monday-Friday
ii. ETA: EOD 11/9/24

@HackforLABot HackforLABot added the To Update ! No update has been provided label Nov 8, 2024
@HackforLABot
Copy link
Contributor

@aadilahmed

Please add update using the below template (even if you have a pull request). Afterwards, remove the 'To Update !' label and add the 'Status: Updated' label.

  1. Progress: "What is the current status of your project? What have you completed and what is left to do?"
  2. Blockers: "Difficulties or errors encountered."
  3. Availability: "How much time will you have this week to work on this issue?"
  4. ETA: "When do you expect this issue to be completed?"
  5. Pictures (optional): "Add any pictures of the visual changes made to the site so far."

If you need help, be sure to either: 1) place your issue in the Questions/In Review column of the Project Board and ask for help at your next meeting, 2) put a "Status: Help Wanted" label on your issue and pull request, or 3) put up a request for assistance on the #hfla-site channel. Please note that including your questions in the issue comments- along with screenshots, if applicable- will help us to help you. Here and here are examples of well-formed questions.

You are receiving this comment because your last comment was before Monday, November 4, 2024 at 11:04 PM PST.

@t-will-gillis
Copy link
Member Author

Hi @aadilahmed Please let me know if you have any questions about this or run into any problems when testing.

@aadilahmed
Copy link
Member

Hi @aadilahmed Please let me know if you have any questions about this or run into any problems when testing.

I unfortunately haven't had time to work on this issue yet, but I will make sure to finish this week. Thanks for the help.

@aadilahmed
Copy link
Member

1. Progress: Still need to complete issue action items
2. Blockers: Little time the past week to work on this issue, however I am more available this week
3. Availability: Tuesday 9pm - 12am, Thursday 2pm-6pm, Friday 9am-5pm, Saturday 9am - 5pm, Sunday 9am-5pm
4. ETA: EOD Sunday 11/17 

@HackforLABot HackforLABot removed the To Update ! No update has been provided label Nov 15, 2024
@aadilahmed
Copy link
Member

Hi @aadilahmed Please let me know if you have any questions about this or run into any problems when testing.

Hi @t-will-gillis ,
I'm trying to test the "Move Closed Issues" GHA, but I'm seeing this error:
image

My process for testing this GHA is to add a new issue to my personal project board, add a label to the issue, then close it. This process results in the error above. The issue does not move to the expected column after being closed.

The only code I've modified so far is to replace the "HACKFORLA_GRAPHQL_TOKEN" and "TEAMS" tokens in move-closed-issues.yaml and issue-trigger.yml with my own secrets.

Any help would be appreciated.

@t-will-gillis
Copy link
Member Author

t-will-gillis commented Nov 17, 2024

Hi @aadilahmed The error is happening because mutate-item-status.js has values from Hack for LA's project and you will need to replace these with the values from your project/repo. To find these you can go to Explorer and substitute in:

query findStatusSubfieldIdsAadilahmed ($login: String!, $projNum: Int!, $fieldName: String!) {
  user(login: $login) {
    projectV2(number: $projNum) {
      id
      field(name:$fieldName) { 
        ... on ProjectV2SingleSelectField { 	
        id options{ 
            id
            name
            ... on ProjectV2SingleSelectFieldOption {
              id
            }
          } 
        }
      }
    }
  }
}  

and:

{
  "login":"aadilahmed",
  "projNum": 1,
  "fieldName": "Status"
}  

(I pulled the values from your repo) You likely will need to replace the values for "Done" and "QA" in status-field-ids.js also based on the results from Explorer since these are used by the "Move Closed Issues" workflow.

This info should have been on the issue so I apologize. Hopefully you were not spinning your wheels for too long on this - and definitely let me know if you run into any other problems.

@aadilahmed
Copy link
Member

Thanks, that solved my issue!

@aadilahmed
Copy link
Member

aadilahmed commented Nov 18, 2024

Comments that reference specific label name:
In check-label-preliminary-update.js:

  • Line 45: //issue states that we are to post the comment if--> there is a role: back end/devOps tag...(continued on next comment)
    Suggested replacement:
    Leave as is, because the name of the tag is being referred to, not the labelName variable

  • line 50: // or if there is a role: front end tag
    Suggest replacement:
    Leave as is, because the name of the tag is being referred to, not the labelName variable

No other uses of labelNames throughout comments.

@aadilahmed aadilahmed moved this from In progress (actively working) to Questions / In Review in P: HfLA Website: Project Board Nov 18, 2024
@t-will-gillis t-will-gillis moved this from Questions / In Review to In progress (actively working) in P: HfLA Website: Project Board Nov 18, 2024
@t-will-gillis
Copy link
Member Author

t-will-gillis commented Nov 18, 2024

Hi @aadilahmed regarding the "Action Item":

- [ ] Prior to submitting the PR, search for all code comment that reference a specific label name

This is in reference to any comments in sort-closed-issues.js only, or any other file where you need to edit labels directly because of this issue. You might not need to edit any comments for this issue- I did not see any.

I edited the "Action Item" to be clearer, and will remove the ready for product label and move this back to "In progress (actively working)"

Thanks!

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 a pull request may close this issue.

4 participants