node-gitlab-2-github icon indicating copy to clipboard operation
node-gitlab-2-github copied to clipboard

Filter gitlab objects with functions

Open iamrgroot opened this issue 2 years ago • 0 comments

I think it would be really nice to remove the settings for skipping item states and replace them with filter functions.

Now:

  skipMergeRequestStates: string[];
  skipMatchingComments: string[];

Suggested:

  skipIssue: (issue: GitLabIssue) => boolean;
  skipMergeRequest: (mr: GitLabMergeRequest) => boolean;
  skipNotes: (note: GitLabNote) => boolean;
  skipMilestone: (note: GitLabMilestone) => boolean;

An example config could be:

  skipMergeRequest: (mr: GitLabMergeRequest) => ['merged', 'closed'].includes(mr.state),
  skipIssue: (issue: GitLabIssue) => {
    if (!issue.closed_at) {
      return false;
    }

    return (new Date(issue.closed_at)).getFullYear() < 2023;
  },

iamrgroot avatar Mar 15 '23 11:03 iamrgroot