MCPcopy Create free account
hub / github.com/decaporg/decap-cms / getPullRequests

Method getPullRequests

packages/decap-cms-backend-bitbucket/src/API.ts:675–699  ·  view source on GitHub ↗
(sourceBranch?: string)

Source from the content-addressed store, hash-verified

673 };
674
675 async getPullRequests(sourceBranch?: string) {
676 const sourceQuery = sourceBranch
677 ? `source.branch.name = "${sourceBranch}"`
678 : `source.branch.name ~ "${CMS_BRANCH_PREFIX}/"`;
679
680 const pullRequests: BitBucketPullRequests = await this.requestJSON({
681 url: `${this.repoURL}/pullrequests`,
682 params: {
683 pagelen: 50,
684 q: oneLine`
685 source.repository.full_name = "${this.repo}"
686 AND state = "${BitBucketPullRequestState.OPEN}"
687 AND destination.branch.name = "${this.branch}"
688 AND comment_count > 0
689 AND ${sourceQuery}
690 `,
691 },
692 });
693
694 const labels = await Promise.all(
695 pullRequests.values.map(pr => this.getPullRequestLabel(pr.id)),
696 );
697
698 return pullRequests.values.filter((_, index) => isCMSLabel(labels[index], this.cmsLabelPrefix));
699 }
700
701 async getBranchPullRequest(branch: string) {
702 const pullRequests = await this.getPullRequests(branch);

Callers 2

getBranchPullRequestMethod · 0.95

Calls 4

getPullRequestLabelMethod · 0.95
isCMSLabelFunction · 0.90
mapMethod · 0.80
filterMethod · 0.80

Tested by

no test coverage detected