Post PBB migration: Refactor "Move Closed Issues" workflow
Overview
The new Projects Beta is structured a little differently from Projects (classic). During to our recent migration from Projects (classic) to Projects Beta, we scrubbed our workflows and removed all functionality that referenced 'columns' as this term is no longer used. We need to refactor our post migration workflows so that they have similar functionality as previously.
Details
The move-closed-issues.yaml file is triggered when an issue is closed. It reviews which labels are on the issue, and prior to migration to Projects Beta, issues with a particular label were assigned to the "QA" column. This file's logic needs to be rewritten in terms of the 'status' field instead, using GraphQL.
Action Items
- [ ] This issue involves GithHub Actions and GraphQL. You will need the new Project Board Beta set up in your repo so that you are able to test and demonstrate your solution. Refer to the "Resources/Instructions" section below to get started, and be sure to let us know if you have questions.
- [ ] In move-closed-issues.yaml, refactor the code using GraphQL so that specific issues are sorted to the 'status' of "Done".
- [ ] Note that sort-closed-issues.js already has the conditionals in place and are reporting the correct final 'status' for each closed issue. Also note that Projects Beta automatically sorts all closed issues to "QA" status. Therefore what remains is to use GraphQL to sort the appropriate issues to "QA" status- but this has to occur after the automatic workflow has completed so that there is no conflict.
- [ ] Previously, this final step happened in
move-closed-issues.yaml, but feel free to make suggestions.
Resources/Instructions
- Initial GraphQL queries and results
- GitHub GraphQL Explorer
- GitHub GraphQL API
- Hack for LAs GitHub Actions
- Pre-migration issues:
- PR #7056 fixes #7039
- This issue initiated by #6993
Hi @t-will-gillis, thank you for taking up this issue! Hfla appreciates you :)
Do let fellow developers know about your:- i. Availability: (When are you available to work on the issue/answer questions other programmers might have about your issue?) ii. ETA: (When do you expect this issue to be completed?)
You're awesome!
P.S. - You may not take up another issue until this issue gets merged (or closed). Thanks again :)
Hi @DrAcula27, thank you for taking up this issue! Hfla appreciates you :)
Do let fellow developers know about your:- i. Availability: (When are you available to work on the issue/answer questions other programmers might have about your issue?) ii. ETA: (When do you expect this issue to be completed?)
You're awesome!
P.S. - You may not take up another issue until this issue gets merged (or closed). Thanks again :)
Availability: weekdays after 5pm Pacific time ETA: September 2
New ETA: 10 September (been very sick this last week, still dealing with it)
Hey @DrAcula27 Sorry to hear you have been sick and hope you are feeling better!
I added a couple of notes to the description above about the existing modules, and let me know if you want to discuss.
@t-will-gillis Thank you! I will keep you posted with any questions.
@t-will-gillis When setting up the new Project Board Beta in my repo, should I create a new project or link to an existing project?
It would be a new project, if I understand your question correctly
Update
- Met with @t-will-gillis and discussed my questions with this issue so far.
- Done so far:
- Better understanding of the issue
- Copied HfLA's project board to my repo
- Created access tokens
- New ETA: Friday, September 13, 2024
@t-will-gillis Will you be available sometime this weekend to help me test what I have for this issue?
Hi @DrAcula27 Continuing our Slack convo, I looked at this again this morning and was able to get it working correctly. Here are some of the things I edited:
-
Like we discussed, step 1 would be unchanged and steps 2 - 4 can be condensed to a single step 2 that calls
move-closed-issues.jsfollowing the same pattern as the other .yml/.yamls. -
For the rev. second step in
move-closed-issues.yaml:resultsshould be in quotations, and- the graphql token needs to be added before
script:, i.e. :
with: github-token: ${{ secrets.HACKFORLA_GRAPHQL_TOKEN }} script: | const results = '${{ steps.sort-closed-issues.outputs.result }}' const script = require('./github-actions/move-closed-issues/move-closed-issues.js') script({github, context}, results) -
For
move-closed-issues.js:- The module import paths were wrong/ relative path should be one level up not two
-
For
query-issue-info.jsthere were some wonky things happening here that I was able to get past by:- defining
ownerandrepoat top and referencing withinvariables - I renamed the variable
projectItems-->projectDatain thetry...catchblock. I believe that graphQL's wires might have gotten crossed because the same termprojectItemsis used in theresponseobject, hence the reason for renaming it.
- defining
Please take a look and let me know, Thanks!
@t-will-gillis It worked! Thank you for all of your help!!
- Link to my GitHub action → https://github.com/DrAcula27/website/actions/runs/10929417866
- I will clean up my code and run the tests with the other labels before making a PR.