From 35061ab8d5cae7c19929740b10df341a26415c80 Mon Sep 17 00:00:00 2001 From: Tom Keller Date: Sat, 30 Apr 2022 10:35:38 -0700 Subject: [PATCH] add PR support --- src/entrypoint.ts | 5 ++++- src/input.ts | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/entrypoint.ts b/src/entrypoint.ts index fc476fe..249d2c5 100644 --- a/src/entrypoint.ts +++ b/src/entrypoint.ts @@ -1,5 +1,6 @@ import * as core from '@actions/core'; -import { getAndValidateInputs } from './input'; +import { getIssues, processIssues } from './github'; +import { allInterestedLabels, getAndValidateInputs } from './input'; /* Step 1: Grab the action inputs @@ -13,6 +14,8 @@ Step 4: Apply labels according to the mapping async function run() { try { const args = getAndValidateInputs(); + const issues = await getIssues(allInterestedLabels(args), args.token); + await processIssues(issues, args); } catch (e) { if (e instanceof Error) { core.setFailed(e.message); diff --git a/src/input.ts b/src/input.ts index 4be0086..2f5f0f9 100644 --- a/src/input.ts +++ b/src/input.ts @@ -42,3 +42,12 @@ export function getAndValidateInputs(): args { prUpdateRemoveLabels, }; } + +export function allInterestedLabels(args: args) { + return [ + ...(args.expirationLabelMap || []), + ...(args.updateRemoveLabels || []), + ...(args.prExpirationLabelMap || []), + ...(args.prUpdateRemoveLabels || []), + ]; +}