From c2c1b853146ee147316a92711f98e38da07d3fe9 Mon Sep 17 00:00:00 2001 From: Polina Semenova Date: Mon, 22 Jul 2024 12:28:58 +0200 Subject: [PATCH] go through all PRs, not first 100 --- .../engineering_projects_manager/index.ts | 54 ++++++++++++++++++- src/shared/project_ids.ts | 15 +++++- 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/src/modules/engineering_projects_manager/index.ts b/src/modules/engineering_projects_manager/index.ts index a499722..e9a358e 100644 --- a/src/modules/engineering_projects_manager/index.ts +++ b/src/modules/engineering_projects_manager/index.ts @@ -3,8 +3,12 @@ import {Issue} from "../../shared/issue"; import { AUTOSCALING, COMPUTE, CONSOLE, - CONTROL_PLANE, DATA, DOCS, - ENGINEERING, INFRA, PIXEL_POINT, POSTGRES, PRODUCT, + CONTROL_PLANE, DATA, + DBAAS, + DOCS, + ENGINEERING, + IDENTITY, + INFRA, PIXEL_POINT, POSTGRES, PRODUCT, PRODUCT_DESIGN } from "../../shared/project_ids"; import {Octokit} from "@octokit/core"; @@ -47,6 +51,12 @@ const FIELD_IDS_BY_PROJECT_ID = { [PIXEL_POINT.projectId]: { trackedIn: PIXEL_POINT.trackedInFieldId, }, + [IDENTITY.projectId]: { + trackedIn: IDENTITY.trackedInFieldId, + }, + [DBAAS.projectId]: { + trackedIn: DBAAS.trackedInFieldId, + }, } const updateTrackedInIfPossible = async (kit: Octokit, projectId: string, issue: Issue) => { @@ -106,4 +116,44 @@ export const engineering_projects_manager_listener = (app: Probot) => { logger("error", e); } }); + + // the code below is for running manually triggered syncs locally: + // + // 1. uncomment the code below and comment our code above, leave only this listener in the webhooks.js + // 2. create a temp field in the project where you want to update Tracked in field + // 3. build & run the bot + // 4. bulk update the temp field in the project + // 5. wait for the bot to update the Tracked in field + // 6. stop the bot + // 7. delete the temp field + // 8. Enjoy! + // + // app.on(["projects_v2_item.edited"], async (context) => { + // // we use this event instead issue.edited because in this event we will get the project_node_id + // if (!(Object.keys(FIELD_IDS_BY_PROJECT_ID)) + // .includes(context.payload.projects_v2_item.project_node_id) + // ) { + // return; + // } + // + // if ((context.payload.changes.field_value.field_node_id === FIELD_IDS_BY_PROJECT_ID[context.payload.projects_v2_item.project_node_id].trackedIn)) { + // logger('info', 'skip because the tracked in value was changed') + // } + // + // const projectId = context.payload.projects_v2_item.project_node_id; + // + // try { + // + // let issue = await Issue.load(context.octokit, context.payload.projects_v2_item.content_node_id); + // + // await updateTrackedInIfPossible(context.octokit, projectId, issue); + // + // const children = await issue.getChildrenIssues(context.octokit); + // for (const childIssue of children) { + // await updateTrackedInIfPossible(context.octokit, projectId, childIssue); + // } + // } catch(e) { + // logger("error", e); + // } + // }); } \ No newline at end of file diff --git a/src/shared/project_ids.ts b/src/shared/project_ids.ts index 136ed89..ef00f79 100644 --- a/src/shared/project_ids.ts +++ b/src/shared/project_ids.ts @@ -117,4 +117,17 @@ export const NEON_RELEASE_STATUS = { projectId: 'PVT_kwDOBKF3Cs4AfDv2', statusLastUpdatedFieldId: 'PVTF_lADOBKF3Cs4AfDv2zgZ0RRw', statusFieldId: 'PVTSSF_lADOBKF3Cs4AfDv2zgUgpnk', -} \ No newline at end of file +} + +// project id: 95 +export const IDENTITY = { + projectId: 'PVT_kwDOBKF3Cs4Ak_eq', + trackedInFieldId: 'PVTF_lADOBKF3Cs4Ak_eqzgdHTgc', +} + +// project id: 87 +export const DBAAS = { + projectId: 'PVT_kwDOBKF3Cs4AkjdS', + trackedInFieldId: 'PVTF_lADOBKF3Cs4AkjdSzgcvnTs', +} +