Skip to content

Commit

Permalink
add PR support
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertk committed Apr 30, 2022
1 parent aa3cf88 commit 35061ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/entrypoint.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions src/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,12 @@ export function getAndValidateInputs(): args {
prUpdateRemoveLabels,
};
}

export function allInterestedLabels(args: args) {
return [
...(args.expirationLabelMap || []),
...(args.updateRemoveLabels || []),
...(args.prExpirationLabelMap || []),
...(args.prUpdateRemoveLabels || []),
];
}

0 comments on commit 35061ab

Please sign in to comment.