Update wins data to be posted to new project board
- Dominant language
- JavaScript
- Stars
- 363
- Forks
- 872
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 18
Description
### Prerequisite
1. Be a member of Hack for LA. (There are no fees to join.) If you have not joined yet, please follow the steps on our [Getting Started page](https://www.hackforla.org/getting-started) and attend an onboarding session.
2. Before you claim or start working on an issue, please make sure you have read our [How to Contribute to Hack for LA Guide](https://github.com/hackforla/website/blob/7f0c132c96f71230b8935759e1f8711ccb340c0f/CONTRIBUTING.md).
### Overview
We need to update the Wins Google Apps scripts so that it starts adding issues from the old project board to the new project board's "Questions/In Review" column.
To set an issue's status, the current code uses a combination of REST API calls and Column Keys. The new project board uses GraphQL API calls and Status Field IDs. We must update this behavior to maintain the Wins workflow.
### Action Items
- [x] Refer to ALL of the steps in the Wins Google App Script documentation to set up your local environment for testing and development. [^1]
- [x] Message a [Team Lead](https://github.com/hackforla/website/wiki/Meet-the-Team) to gain access to the following files required for this issue:
- Wins Form Admin Guide (To understand the Wins workflow)
- Wins-form (Responses) Google Sheet
- Wins-form Google Form
- gh-requests Google Document
- [x] Set up your testing and development environment with the documentation provided.
- [x] Trace how Wins are posted as issues to the old project board by reviewing `addIssueToProjectBoardColumn` in the following files:
- `google-apps-scripts/gh-requests/Code.js`
- `google-apps-scripts/wins-form-responses/Code.js`
- [x] In`gh-requests/Code.js`:
- [x] Remove and replace classic Projects REST API calls with GraphQL mutations for Projects v2 compatibility by refactoring `addIssueToProjectBoardColumn`. Rename the function to reflect this migration. [^2]
- [x] You will need to add a GraphQL request helper, similar to existing REST request helpers.
- [x] In `wins-form-responses/Code.js`:
- [x] Refer to the Status Field IDs utility file then note `PROJECT_ID`, `FIELD_ID`, and any issue status fields that need to be replaced. [^3]
- [x] Replace `COLUMN_KEYS` with a Project v2 Status Field ID object. Include `PROJECT_ID` and `FIELD_ID` as they will be needed for GraphQL calls.
- [x] Edit the `createIssue` function with your updated `addIssueToProjectBoard` function.
- [x] Ensure that the issue Status Field ID is set to `"InReview"`.
- [x] Additional fix for column numbering issue in `wins-form-responses/Code.js`:
- In the `main` function, replace:
```
// Filter out only the rows where display-column(colum 15) is set to true
const filteredRows = Array.from(allRows).filter(win => win[15] === true);
```
with:
```
// Filter out only the rows where display column is set to true
const display = columnHeaders.indexOf("Display?");
if (display == -1){
console.log("Ending script; Display column not found.");
return 1;
}
const filteredRows = Array.from(allRows).filter(win => win[display] === true);
```
- [x] Test your changes locally and verify that any test Wins submissions populate your local fork.
- [x] While testing, ensure the Wins responses Sheet contains LinkedIn Name and GitHub Handle columns as specified in 3.d of the Wins documentation. [^1]
- [x] Remove any console output for GitHub PAT
- [x] Refer to `9. Completing an issue` in the Wins documentation before you create your PR. [^1]
### Resources/Instructions
- Wins page URL: https://www.hackforla.org/wins
[^1]: Wins Google App Script documentation and how to set up testing environment: [Wins Google App Script Development Process](https://docs.google.com/document/d/12ARuJ3S6MTS11-sMEZZTEweJB43-4tL6EU0IrMsWuM4/edit?usp=drivesdk)
[^2]: GitHub Projects v2 GraphQL Documentation (take a look at addProjectV2ItemById and updateProjectV2ItemFieldValue): https://docs.github.com/en/graphql/reference/projects
[^3]: Website Project v2 Status Field IDs: https://github.com/hackforla/website/blob/gh-pages/github-actions/utils/_data/status-field-ids.js
Contributor guide
Assessment
This issue has not been assessed yet.