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

Refactoring check-labels.js to use label-directory.json #7777

Open
wants to merge 5 commits into
base: gh-pages
Choose a base branch
from

Conversation

t-will-gillis
Copy link
Member

@t-will-gillis t-will-gillis commented Nov 28, 2024

Fixes #7531

What changes did you make?

  • In check-labels.js, replaced labelNames with equivalent labelKey values and call to retrieveLabelDirectory
  • Moved hard-coded values from mutate-issue-status.js and consolidated into status-field-ids.js
  • Changed variable name and corrected error message in mutate-issue-status.js

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

  • We are refactoring codebase to use the labelKey values so that the functions can be shared throughout the org
  • Having all of the hard-coded values in one location makes them easier to track.

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

Screenshot 2024-10-28 154514

Please let us know that you have checked for CodeQL alerts. Please do not dismiss alerts.

  • I have checked this PR for CodeQL alerts and none were found.
  • I found CodeQL alert(s), and (select one):
    • I have resolved the CodeQL alert(s) as noted
    • I believe the CodeQL alert(s) is a false positive (Merge Team will evaluate)
    • I have followed the Instructions below, but I am still stuck (Merge Team will evaluate)
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)

Notes for Reviewers

In order to review this issue, you will need to set up your environment first:

  • Refer to Hack for LA's GitHub Actions (current revision), especially Tips 6, 7, and 8, if you have not already created you personal environment for testing.
  • How to Test GitHub Actions
  • Additional Notes for GitHub Actions
  • To test the first part of this: go to "Issues" in your repo, select "New issue", and select any of the issues templates. Remove any labels that are there, and add back either no labels or one or two such as good first issue and size: 5pt, then create issue. The bot should add the Complexity: missing, role: missing, etc. as appropriate.
  • To test the second part of this, there is a little bit more work to do:
    • First, open GithHub's GraphQL Explorer. Link up to your repo if needed
    • Go to github-actions/utils/_data/status-field-ids.js and scroll down to the comments. Copy lines 47-62 in the query section, and lines 64-68 under variables. Replace with your login and the number of your project board- it is probably '1' but you can check by selecting "Projects" from your repo and seeing what number yours is.
    • Run Explorer, then change "organization" to "user", substitute your values for the "projectV2" and "filed" ids, as well as the value for "Questions/ In Review", into status-field-ids.js.
    • Go to "Issues" again, select "New issue", find "Blank Issue Template" and select "Get started". Remove all the labels, then title your issue:
    The Hack for LA website bot removed me!  
    
    • Then "Submit new issue". If everything works, the issue will be labelled correctly and moved to "Status" "Questions/ In Review"

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-check-labels-7531 gh-pages
git pull https://github.com/t-will-gillis/website.git refactor-check-labels-7531

@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 Nov 28, 2024
Fix indent in comments section
@codyyjxn codyyjxn self-requested a review December 5, 2024 05:25
@ajb176 ajb176 self-requested a review December 23, 2024 12:33
@ajb176
Copy link
Member

ajb176 commented Dec 23, 2024

ETA: First week of Jan

Update: Sorry, I'll get to it this weekend.

@ajb176
Copy link
Member

ajb176 commented Jan 12, 2025

Hey @t-will-gillis

The first part works as expected, but I'm having trouble getting the GraphQL query to run:

This is the output I'm seeing: Screenshot 2025-01-12 at 11 35 55 PM

When you say 'link up to your repo if needed' what exactly do you mean? I haven't used GraphQL before, so maybe I'm missing some setting that enables GraphQL queries to be run on my account or something. Any ideas?

@t-will-gillis
Copy link
Member Author

Hey @ajb176 Thanks for the comments

Oof- With Explorer, I neglected to mention that you will need to change "organization" to "user" in the GraphQL script, but after that it should work:

Screenshot 2025-01-12 103815

When you say 'link up to your repo if needed' what exactly do you mean?

I meant that you needed to be signed in- and in your screen shot you are signed in so that part is ok.

Have you copied the HfLA Project Board to your repo yet? I don't see it in your repo... If you haven't, you would need to do that first because that is where the ids are coming from.

@ajb176
Copy link
Member

ajb176 commented Jan 13, 2025

Yup, that fixed it.

But now I'm getting an error when the workflow runs here

The query-issue-info.js seems to try to get the issue status through this line:

const projectData = response.repository.issue.projectItems.nodes;

When I run that GraphQL query in Explorer with the variables from my repository, that projectItems.nodes field is empty. Although the project board is linked, new issues don't seem to be added to it automatically. Maybe there's some configuring that needs to be done in the Project Board -> Settings -> Workflows menu?

I'll look into this more a little later this week, but let me know if you have any idea on what the issue might be.

The project board seems like it's private by default when created, I just made it public.

@t-will-gillis
Copy link
Member Author

Hey Ajay- Yes, I agree with everything you say.

There should have been an automatic workflow created when you copied over HfLA's, and that should be moving new issues into "New Issue Approval":

Screenshot 2025-01-13 103702

That would be the reason why the workflow is failing: the issue should be automatically added to the "Project Board" before the "Issue Trigger" runs.

Copy link
Member

@ajb176 ajb176 left a comment

Choose a reason for hiding this comment

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

Just had to manually configure the workflows, for some reason the workflows were copied but they weren't configured the same way

Everything looks good to me, and the label and project board workflows behave as expected

Nice work, Will

@t-will-gillis
Copy link
Member Author

Hey @codyyjxn Checking to see if you will be able to review this still. If so, could you leave an eta? Thanks!

@daras-cu
Copy link
Member

@codyyjxn are you still planning to review this PR? If so, please leave an ETA and availability for your review. 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
Status: PR Needs review
Development

Successfully merging this pull request may close these issues.

Refactor GHA check-labels.js to use label-directory.json
3 participants