From 24a71c0501324a2453fbc489b7ebabea217e31f7 Mon Sep 17 00:00:00 2001 From: Craig Silverstein Date: Tue, 12 Nov 2024 15:12:47 -0800 Subject: [PATCH] share a type --- src/runOnPullRequest.js | 3 +-- src/runOnPush.js | 3 +-- src/utils.js | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/runOnPullRequest.js b/src/runOnPullRequest.js index a136737..9fd6532 100644 --- a/src/runOnPullRequest.js +++ b/src/runOnPullRequest.js @@ -21,8 +21,7 @@ import { GERALD_COMMENT_REVIEWERS_HEADER, MATCH_COMMENT_HEADER_REGEX, } from './constants'; - -type NameToLabelToFiles = {[name: string]: {[label: string]: string[], ...}, ...}; +import type {NameToLabelToFiles} from './utils'; /** * @desc Helper function to update, delete, or create a comment diff --git a/src/runOnPush.js b/src/runOnPush.js index 2d589f2..e158e09 100644 --- a/src/runOnPush.js +++ b/src/runOnPush.js @@ -4,8 +4,7 @@ import {getNotified, getFileDiffs, getFileContents} from './utils'; import {execCmd} from './execCmd'; import {ownerAndRepo, extraPermGithub, type Context} from './setup'; import {PUSH, GERALD_COMMIT_COMMENT_HEADER} from './constants'; - -type NameToLabelToFiles = {[name: string]: {[label: string]: string[], ...}, ...}; +import type {NameToLabelToFiles} from './utils'; const makeCommitComment = async (peopleToLabelToFiles: NameToLabelToFiles, commitSHA: string) => { const names: string[] = Object.keys(peopleToLabelToFiles); diff --git a/src/utils.js b/src/utils.js index 1a6192f..98221c4 100644 --- a/src/utils.js +++ b/src/utils.js @@ -36,9 +36,10 @@ import { type Section = 'pull_request' | 'push'; type GeraldFile = 'NOTIFIED' | 'REVIEWERS'; -type NameToLabelToFiles = {[name: string]: {[label: string]: string[], ...}, ...}; type CommentHeaders = 'Reviewers' | 'Required Reviewers' | 'Notified'; +export type NameToLabelToFiles = {[name: string]: {[label: string]: string[], ...}, ...}; + /** * @desc Make the comment body for each of the Gerald sections. *