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

Check Developer's Complexity Allowance for Issue Assignments #6853

Merged

Conversation

jphamtv
Copy link
Member

@jphamtv jphamtv commented May 14, 2024

Fixes #4442

What changes did you make?

  • Added new file github-actions/trigger-issue/add-preliminary-comment/developer-complexity-reminder.md
  • Added new file github-actions/trigger-issue/add-preliminary-comment/check-complexity-eligibility.js and created script that checks for complexity allowance and handles actions if issue exceeds complexity allowance
  • In the file github-actions/trigger-issue/preliminary-update-comment.js file:
    • Imported checkComplexityEligibility function module
    • Added condition logic to skip posting the preliminary update comment if the issue is not within complexity allowance (check-complexity-eligibility.js script will handle posting a comment)

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

  • We want to create a GitHub action script to check and notify when developers assign themselves to too many issues of specified complexity (up to medium sized issue).
  • New developers for the website team are expected to follow the chain of complexity progression when assigning themselves to an issue: two good first issues, one small issue, one medium issue, and at least one large issue. We make an exception to this progression for developers who apply both front end and back end roles on their prework issues.

Information For Testing

  1. Create a copy of the Project Board by following the directions outlined in Tip 6: Creating your own Project Board.

  2. Create a personal access token that will allow the automation to work on your duplicated project board by following the directions outlined in Tip 7: Using Personal Access Tokens to test in your own Project Board.

  3. Copy Hack for LA's website repo labels into your repo using GH CLI. This command will clone the labels from the source repository to your own repository. Install the tool, login, then use this command (replace "your-username/your-repo" with your repo's information):

    gh label clone hackforla/website --repo your-username/your-repo
    
  4. To quickly create test issues on your repository's project board, use the GitHub CLI and run the script provided in this repository: https://github.com/jphamtv/create-issues-script

    Follow the instructions in the script's README file to set it up and execute it.

  5. Please note that the script skips checking for complexity when the creator of an issue assigns themselves to that issue. To properly test the complexity eligibility checks, you'll need to create a separate GitHub test account.

  6. Use the test account to self-assign the Pre-work Checklist (Skills Issue) and other issues created by the script. This will ensure that the complexity eligibility checks are triggered correctly.

  7. Update the secret token in Ask-For-Preliminary-update job in the github/workflows/issue-trigger.yml file

  8. In github-actions/utils/mutate-issue-status.js file, change the ID numbers in WEBSITE_PROJECT_ID and STATUS_FIELD_ID constants to match your repo Project Board's IDs. In github-action/utils/_data/status-field-ids.js file, change the ID values in statusValues for New_Issue_Approval and In_Progress to match your repo Project Board's IDs. You can get your Project Board's info from the GitHub GraphQL Explorer using the following query:

    query {
      viewer {
        projectV2(number: 1) {
          id
          fields(first:20) {
            nodes {
              ... on ProjectV2Field {
                id
                name
              }
              ... on ProjectV2SingleSelectField {
                id
                name
                options {
                  id
                  name
                }
              }
            }
          }
        }
      }
    }
    
  9. In github-actions/trigger-issue/preliminary-update-comment.js file, add the following to the top of memberOfAdminOrMergeTeam function to mock the member status. Replace your_username and your_repository_name with your own information:

    if (context.repo.owner === 'your_username' && context.repo.repo === 'your_repository_name') {
      console.log('Testing environment detected. Mocking not a member of Admin or Merge team.');
      return false;
    }
    
  10. In your fork of the website repository, go to "Settings" and change the default branch from gh-pages to this PR's branch.

  11. Self-assign the Pre-work Checklist (Skills Issue) with your test account and then close the issue. It should automatically move to the QA column. This is to make sure it gets moved to the In Progress column after the script re-opens it.

  12. Move issues to the Prioritized Backlog and self-assign issues to test the criteria described in the "Your script should check the following" Action Item.

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 jphamtv-check-complexity-eligibility-4442 gh-pages
git pull https://github.com/jphamtv/hackforla-website.git check-complexity-eligibility-4442

@github-actions github-actions bot added role: front end Tasks for front end developers P-Feature: Program Area https://www.hackforla.org/program-areas time sensitive Needs to be worked on by a particular timeframe Complexity: Small Take this type of issues after the successful merge of your second good first issue size: 0.25pt Can be done in 0.5 to 1.5 hours labels May 14, 2024
@jphamtv jphamtv changed the title Check Developer's Complexity Eligibility for Issue Assignments Check Developer's Complexity Allowance for Issue Assignments May 14, 2024
@github-actions github-actions bot removed role: front end Tasks for front end developers P-Feature: Program Area https://www.hackforla.org/program-areas time sensitive Needs to be worked on by a particular timeframe Complexity: Small Take this type of issues after the successful merge of your second good first issue size: 0.25pt Can be done in 0.5 to 1.5 hours labels May 14, 2024
@t-will-gillis
Copy link
Member

Hey @jphamtv You had put a ton of work into this before the projects migration fracked up everything... Were you planning to give this another go?

@jphamtv
Copy link
Member Author

jphamtv commented Aug 19, 2024

Hey @jphamtv You had put a ton of work into this before the projects migration fracked up everything... Were you planning to give this another go?

Hi @t-will-gillis, thanks for checking in. Yes, I'll update and test later this week. I'll message you when it's ready for your review.

@github-actions github-actions bot added the GHA New Project Board compatible This GitHub Action issue does not reference columns and will work with the new board label Aug 21, 2024
@jphamtv
Copy link
Member Author

jphamtv commented Aug 21, 2024

Hey @t-will-gillis, I've updated and tested the code on my repo. It's now compatible with the new Projects V2 board and includes updates such as skipping the eligibility check for Admin or Merge team members. I've also revised the testing instructions, with specific changes to Step 8. Please let me know if you need clarification or have questions.

@jphamtv jphamtv requested a review from t-will-gillis August 21, 2024 20:38
@t-will-gillis
Copy link
Member

t-will-gillis commented Aug 30, 2024

Hey @jphamtv - whew, just like before this is a ton of work and the project migration did not help so thanks once again for tackling this. I am still reviewing but here are prelim comments. I have it running in my repo but still need to try a couple different scenarios to trigger the comments.

This is going to be very annoying so I will apologize in advance. We have had a string of PRs that have similar functions, for example retrieving issue data and changing the issue’s status. These are pulled out into /utils/query-issue-info.js, /utils/mutate-issue-status.js, and /utils/data/status-field-ids.js, and I am writing issues to refactor “Schedule Friday” and “Issue Trigger” to use these modules and simplify files.

  • We might need to discuss over Slack about how to approach this. I have a branch here if you are curious that I have not submitted yet for refactoring preliminary-update-comment.js which I am thinking should be held off until your PR is done, but hoping that you won’t mind to refactor check-complexity-elegibility.js to use /utils/query-issue-info.js, /utils/mutate-issue-status.js, and /utils/data/status-field-ids.js. Let me know what you think.
  • Regarding changes to format-comment.js: These look good; however this file is used by four other workflows so we can’t make changes without editing the other files also.
  • I imagine this will be OK, but will need to check that the new “Skills Issue” works now that it is replacing the “Pre-work Checklist”

To let you know, that is good info in your description and I edited the Hack for LA’s GitHub Actions (current revision) document to include your code for copying all of HfLA’s labels at once to one’s repo and for generating issues- new Tip 8.

@jphamtv
Copy link
Member Author

jphamtv commented Sep 6, 2024

Hey @t-will-gillis,

This is going to be very annoying so I will apologize in advance. We have had a string of PRs that have similar functions, for example retrieving issue data and changing the issue’s status. These are pulled out into /utils/query-issue-info.js, /utils/mutate-issue-status.js, and /utils/data/status-field-ids.js, and I am writing issues to refactor “Schedule Friday” and “Issue Trigger” to use these modules and simplify files.

  • We might need to discuss over Slack about how to approach this. I have a branch here if you are curious that I have not submitted yet for refactoring preliminary-update-comment.js which I am thinking should be held off until your PR is done, but hoping that you won’t mind to refactor check-complexity-elegibility.js to use /utils/query-issue-info.js, /utils/mutate-issue-status.js, and /utils/data/status-field-ids.js. Let me know what you think.

Thanks for pointing out the new utils. I somehow missed them when updating the code after the migration. I've refactored check-complexity-eligibility.js to use the utils and tested it on my repo. It should be good to go now.

  • Regarding changes to format-comment.js: These look good; however this file is used by four other workflows so we can’t make changes without editing the other files also.

I appreciate you letting me know that format-comment.js is used by other workflows. I should have caught this myself. I've reverted the code and included the formatComment function for multiple replacement objects in the check-complexity-eligibility.js file.

  • I imagine this will be OK, but will need to check that the new “Skills Issue” works now that it is replacing the “Pre-work Checklist”

The Skills Issue will also work if it continues using the Complexity: Prework label.

To let you know, that is good info in your description and I edited the Hack for LA’s GitHub Actions (current revision) document to include your code for copying all of HfLA’s labels at once to one’s repo and for generating issues- new Tip 8.

Thank you for the feedback on my description, including my code in the wiki, and the recognition!

I updated step 8 in the testing instructions above. Please let me know if you need anything else for this PR or if we need to discuss how to handle the preliminary-update-comment.js file with your recent updates in #7373.

@t-will-gillis
Copy link
Member

t-will-gillis commented Sep 12, 2024

Hey @jphamtv I have been testing this and wanted to give you an update. It took a lot of tweaking to get the conditions set up where the other conditions were not triggered first, but now have it so that the check-complexity-eligibility.js is running. Unfortunately an error keeps popping up for me that appears to be in the fetchIssuesByAssignee() function (starting on line 127):

Error fetching issues for assignee t-will-gillis TypeError: Cannot read properties of null (reading 'id')

So one or more of the issues in my repo (or possibly a PR?) is returning null values. Link here But I have not been able to track it down yet.

I don’t know if this is a problem with the issues in my repo alone, or if something similar would occur in the live repo. If you have any good ideas, please let me know. Otherwise, it will take me a while to track down.

@jphamtv
Copy link
Member Author

jphamtv commented Sep 12, 2024

@t-will-gillis - You might be getting the error because you have three Prework checklists assigned to yourself on your repo. Try assigning only one and see if you still get the error.

@t-will-gillis
Copy link
Member

@jphamtv Closed two of the three preworks (thank you), still had the issue. Did a little more digging and found that three of my very early issues were returning "null" on "assignee.id" even though of course I was assigned (under "assignees"). Whatefs I removed those three issues and the previous error is no longer happening. will continue...

Copy link
Member

@t-will-gillis t-will-gillis left a comment

Choose a reason for hiding this comment

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

Hey @jphamtv I was able to run a successful demo in my repo for the situation a.) not checking if admin or merge, b.) previously assigned closed issue Complexity: Small with role: back end/devOps, c.) attempting to open a second issue matching the same size and role of closed issue. Result was that the issue was unassigned, moved to “New Issue Approval”, labeled Ready for Prioritization, and commented on with the specified comment. Furthermore, the “Skills Issue” was reopened and the same comment applied.

I also tried opening a good first issue with two closed good first issues and got the same result. (I did not check the condition for role: back end/devOps and role: front end at the same time.)

Fantastic work on this- especially with all of the moving parts. Thanks for incorporating the modules, providing the code snippets, and for addressing the Projects migration and previous comments.

@t-will-gillis t-will-gillis merged commit c2de085 into hackforla:gh-pages Sep 16, 2024
7 checks passed
@jphamtv jphamtv deleted the check-complexity-eligibility-4442 branch September 26, 2024 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complexity: Extra Large Feature: Board/GitHub Maintenance Project board maintenance that we have to do repeatedly 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
Projects
Development

Successfully merging this pull request may close these issues.

GitHub Actions: Notify developers if they are working on issues of the same complexity
4 participants