Skip to content

Commit

Permalink
Add isDraftPR isOpenPR isMergedPR isClosedPR (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
yakov116 committed Feb 22, 2021
1 parent f4a4174 commit 002d16e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ collect.set('isQuickPR', [
'https://github.com/sindresorhus/refined-github/compare/test-branch?quick_pull=1',
]);

export const isDraftPR = (): boolean => exists('#partial-discussion-header [title="Status: Draft"]');
export const isOpenPR = (): boolean => exists('#partial-discussion-header [title="Status: Open"], #partial-discussion-header [title="Status: Draft"]');
export const isMergedPR = (): boolean => exists('#partial-discussion-header [title="Status: Merged"]');
export const isClosedPR = (): boolean => exists('#partial-discussion-header [title="Status: Closed"], #partial-discussion-header [title="Status: Merged"]');

export const isReleasesOrTags = (url: URL | HTMLAnchorElement | Location = location): boolean => /^tags$|^releases($|\/tag)/.test(getRepo(url)?.path!);
collect.set('isReleasesOrTags', [
'https://github.com/sindresorhus/refined-github/releases',
Expand Down

0 comments on commit 002d16e

Please sign in to comment.