Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "lib/api/mapping/support/commonPushTests"

Index

Variables

Const AnyPush

AnyPush: PushTest = pushTest("Any push", async () => true)

Match on any push

param
constructor

Const FromAtomist

FromAtomist: PushTest = pushTest("Push from Atomist", async p =>p.push.after.message.includes("[atomist]"))

Is this a push originated by Atomist? Note that we can't look at the committer, as if a user invoked a command handler, their credentials will be used

param
returns
constructor

Const IsPushToBranchWithPullRequest

IsPushToBranchWithPullRequest: PushTest = pushTest("Push to branch with open pull request", async p => {if (p.push.branch === p.push.repo.defaultBranch) {return false;}const result = await p.context.graphClient.query<PullRequestsForBranch.Query, PullRequestsForBranch.Variables>({name: "PullRequestsForBranch",variables: {repo: p.push.repo.name,owner: p.push.repo.owner,branch: p.push.branch,},});const branch: PullRequestsForBranch.Branches = _.get(result, "Repo[0].branches[0]");if (branch && branch.pullRequests && branch.pullRequests.some(pr => pr.state === "open")) {return true;}return false;})

Is this push to a non-default branch that has an open pull request?

Const NonEmpty

NonEmpty: PredicatePushTest = predicatePushTest("NonEmpty",async p => (await p.totalFileCount()) > 0)

PushTest that returns true if project is non empty

type

{PredicatePushTest}

Const ToDefaultBranch

ToDefaultBranch: PushTest = pushTest("Push to default branch", async p =>p.push.branch === p.push.repo.defaultBranch ||((!p.push.repo.defaultBranch || p.push.repo.defaultBranch.length === 0) && p.push.branch === "master"))

Functions

hasFile

hasFileContaining

hasFileWithExtension

Generated using TypeDoc