Created
April 19, 2019 12:01
-
-
Save ipcrm/699917efcca4dce6e76b309d0090030c to your computer and use it in GitHub Desktop.
Schedule Goals from PR Event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sdm.addPullRequestListener(async prl => { | |
const repo = await fetchBranchTips( | |
prl.context, | |
{ | |
repo: prl.pullRequest.repo.name, | |
owner: prl.pullRequest.repo.owner, | |
providerId: prl.pullRequest.repo.org.provider.providerId, | |
}, | |
); | |
const id = GitHubRepoRef.from({ | |
owner: prl.pullRequest.repo.owner, | |
repo: prl.pullRequest.repo.name, | |
branch: prl.pullRequest.branch.name, | |
sha: repo.branches.filter(b => b.name === prl.pullRequest.branch.name)[0].commit.sha, | |
}); | |
const push = await fetchPushForCommit(prl.context, id, repo.org.provider.providerId); | |
await chooseAndSetGoals({ | |
projectLoader: sdm.configuration.sdm.projectLoader, | |
repoRefResolver: sdm.configuration.sdm.repoRefResolver, | |
goalsListeners: [...sdm.goalsSetListeners], | |
goalSetter: sdm.pushMapping, | |
implementationMapping: sdm.goalFulfillmentMapper, | |
}, { | |
context: prl.context, | |
credentials: prl.credentials, | |
push, | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment