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

Create JSON file and related functionality to support replacement of hard-coded issue labels #5205

Closed
9 tasks done
Tracked by #6454
rdhmdhl opened this issue Aug 15, 2023 · 18 comments · Fixed by #6442
Closed
9 tasks done
Tracked by #6454
Assignees
Labels
Complexity: Large Feature: Refactor GHA Refactoring GitHub actions to fit latest architectural norms GHA New Project Board compatible This GitHub Action issue does not reference columns and will work with the new board role: back end/devOps Tasks for back-end developers size: 5pt Can be done in 19-30 hours time sensitive Needs to be worked on by a particular timeframe

Comments

@rdhmdhl
Copy link
Member

rdhmdhl commented Aug 15, 2023

Overview

  • Labels are hard-coded and spread throughout our Github Action files.
  • If a label is changed in the repo, we have to investigate where that label was being used in Github Actions, and update it.
  • We need to add a JSON file containing key/value pairs of the labels in the repository, and import it into each GHA file that uses labels

Action Items

  • Create JSON file with key/value pairs for all repository labels (e.g. a "label directory"). This file should include:
    • Create a Key for each label, written in camelCase: e.g. key for "Time Sensitive" would be "timeSensititve", etc.
    • The Value should be an array of the ["label id", "label display name"]
  • Save JSON file to repo in a new subfolder called github-actions/utils/_data/label-directory.json
  • Write JS file that queries the JSON file and returns the label display name when given the Key

To be useful and meet the requirements that initiated this issue, the JSON cannot be static. Whenever a label is updated with a new name or when a new label is added to the repo, the change must propagate dynamically and update the JSON file (i.e. JSON needs CRUD.)

Merge Team:

Resources/Instructions

@rdhmdhl rdhmdhl added role: back end/devOps Tasks for back-end developers Complexity: Large Feature: Refactor GHA Refactoring GitHub actions to fit latest architectural norms size: 1pt Can be done in 4-6 hours labels Aug 15, 2023
@rdhmdhl rdhmdhl self-assigned this Aug 15, 2023
@github-actions

This comment has been minimized.

@rdhmdhl rdhmdhl added ready for dev lead Issues that tech leads or merge team members need to follow up on size: 3pt Can be done in 13-18 hours and removed size: 1pt Can be done in 4-6 hours labels Aug 15, 2023
@roslynwythe roslynwythe added ready for product and removed ready for dev lead Issues that tech leads or merge team members need to follow up on labels Aug 19, 2023
@wanyuguan wanyuguan added this to the 03.02 Onboarding flow milestone Aug 19, 2023
@roslynwythe

This comment was marked as outdated.

@ExperimentsInHonesty

This comment was marked as outdated.

@ExperimentsInHonesty ExperimentsInHonesty added the ready for dev lead Issues that tech leads or merge team members need to follow up on label Jan 26, 2024
@ExperimentsInHonesty ExperimentsInHonesty added the time sensitive Needs to be worked on by a particular timeframe label Feb 28, 2024
@ExperimentsInHonesty ExperimentsInHonesty added Added to dev/pm agenda Draft Issue is still in the process of being created labels Mar 4, 2024

This comment has been minimized.

@t-will-gillis

This comment was marked as resolved.

@t-will-gillis

This comment was marked as resolved.

@t-will-gillis

This comment was marked as resolved.

@t-will-gillis t-will-gillis removed the ready for dev lead Issues that tech leads or merge team members need to follow up on label Mar 8, 2024
@t-will-gillis t-will-gillis changed the title Create a JSON file with key/value pairs for repository labels, import in check-labels.js to replace hard-coded labels Create JSON file and related functionality to support replacement of hard-coded issue labels Mar 8, 2024
@ExperimentsInHonesty
Copy link
Member

@t-will-gillis we actually have a spreadsheet and a script that has all the lables and pulls new ones in. We just need to add to it the variable information. Its current use is for supporting the dashboard.

@ExperimentsInHonesty
Copy link
Member

I guess the point I am making is we need one source of truth.

@ExperimentsInHonesty ExperimentsInHonesty added ready for dev lead Issues that tech leads or merge team members need to follow up on and removed Ready for Prioritization labels Mar 15, 2024
@t-will-gillis
Copy link
Member

t-will-gillis commented Mar 15, 2024

@ExperimentsInHonesty I will add this to the Monday meeting schedule.

Where is the spreadsheet and script? Is it this one?

For what it is worth, this is how I was thinking about it (apologies for talking through it- helps me to understand):

We know that:

  • Currently when the GHAs refer to a label, it is a reference to the actual label name value (eg 2 weeks inactive).
  • We are creating a new JSON file to match up new 'key' labels to the existing 'value' labels. ("2WeeksInactive" : 2 weeks inactive)
  • Now instead of the actual name value of the label, the GHAs reference the key value, and we have internal function to read the JSON and return the actual value for the key.

So far so good. Next, my thought was what happens when we want to change a label, for example if the final label is going to be 🥱 2 weeks inactive. One way to do it:

  • Add a completely new label to the repo, then manually edit the JSON to make sure that the old key now refers to the new name value (while making sure that there are no differences in white space or letter casing or the GHA won't find the label). The old label still exists, and now there also is a new label to keep track of. For the dashboard I assume that both labels would need to be tracked now since both labels refer to 2 weeks inactive

What I am thinking:

  • If we want the label to be 🥱 2 weeks inactive, we just edit the 2 weeks inactive label directly. This can trigger a GHA that updates the JSON file automatically to the new value for the same key. Then since we are editing the existing label itself, this new label gets applied retroactively to previous issues- it is still the same label.
  • The source of truth would be the repo itself.
  • For the Dashboard: if the script pulls the labels via the label Id, nothing needs to change because the Id is the same. If the Dashboard script pulls the labels via the name, we will need to update the script, but that would be no worse than the previous option...

@ExperimentsInHonesty
Copy link
Member

@t-will-gillis

This comment was marked as resolved.

@ExperimentsInHonesty

This comment was marked as outdated.

@ExperimentsInHonesty ExperimentsInHonesty added ready for product and removed ready for dev lead Issues that tech leads or merge team members need to follow up on labels May 7, 2024
@ExperimentsInHonesty
Copy link
Member

ExperimentsInHonesty commented May 7, 2024

@github-actions github-actions bot added the 2 weeks inactive An issue that has not been updated by an assignee for two weeks label May 24, 2024

This comment was marked as outdated.

@t-will-gillis
Copy link
Member

t-will-gillis commented May 28, 2024

Progress:
@ExperimentsInHonesty I believe this works as intended, other than tweaks and final location of the Source of Truth file (Source of Truth in Website Drive currently). Do we want to review it one last time?

  • Created "Current Labels- Website Repo" Google Sheets file:
    • Apps Script queries GitHub and records all of the Website's current "labelNames" and "labelIds".
    • After first use, this Apps Script and worksheet will query the GH repo labels on a schedule so that this info can be compared with the 'Source of Truth' document. (For first use, creates temporary "keyNames" so that a "Label Object" can be saved as JSON)
  • Created label-directory.json JSON file to store reference info on "Label Object"
  • Created update-label-directory.yml workflow, triggered by GitHub Label events: edits, deletions, and creations
    • These label events are compared to the JSON file. For label edits and creations, JSON "Label Object" is updated. For label deletions, "labelId" is reset to '9999999999' but "Label Object" is not removed from JSON.
    • Writes the label events to an "Updates Log" on the 'Source of Truth' file.
  • Created 'Source of Truth' - "Label Object" updated in 'Source of Truth' with flag notification of change.
  • This is a working copy of the 'Source of Truth' document- the four entries are test examples showing created, edited, and deleted labels.
  • The GHA workflow and Google Apps Script work together to keep the actual GitHub labels, the JSON, and the 'Source of Truth' coordinated.
  • Code is in place so that GitHub Actions can reference the "keyName" of the "Label Object" and return with a "Label Name"

@github-actions github-actions bot removed the 2 weeks inactive An issue that has not been updated by an assignee for two weeks label May 31, 2024
@ExperimentsInHonesty ExperimentsInHonesty added the GHA New Project Board compatible This GitHub Action issue does not reference columns and will work with the new board label Jun 18, 2024
@ExperimentsInHonesty ExperimentsInHonesty moved this to In progress (actively working) in P: HfLA Website: Project Board Jun 23, 2024
@github-project-automation github-project-automation bot moved this from In progress (actively working) to QA in P: HfLA Website: Project Board Sep 14, 2024
@kgold2018 kgold2018 moved this from QA to Done in P: HfLA Website: Project Board Nov 24, 2024
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 GHA New Project Board compatible This GitHub Action issue does not reference columns and will work with the new board role: back end/devOps Tasks for back-end developers size: 5pt Can be done in 19-30 hours time sensitive Needs to be worked on by a particular timeframe
Projects
Development

Successfully merging a pull request may close this issue.

5 participants