Skip to content

Commit

Permalink
fix: Revert "fix(1537): Fix ~pr trigger and ~pr:branch trigger have t…
Browse files Browse the repository at this point in the history
…he same behavior (#22)" (#23)

This reverts commit eab8995.
  • Loading branch information
d2lam authored May 10, 2019
1 parent eab8995 commit f08d2ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 2 additions & 6 deletions lib/getNextJobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,12 @@ const getNextJobs = (workflowGraph, config) => {
if (triggerBranch && triggerBranch[1] === edgeSrcBranch[1]) {
// Check if trigger branch and edge src branch regex match
if (triggerBranch[2].match(edgeSrcBranch[2])) {
if (config.trigger.startsWith('~pr')) {
jobs.add(`PR-${config.prNum}:${edge.dest}`);
} else {
jobs.add(edge.dest);
}
jobs.add(edge.dest);
}
}
} else if (edge.src === config.trigger) {
// Make PR jobs PR-$num:$cloneJob (not sure how to better handle multiple PR jobs)
if (config.trigger === '~pr' || config.trigger.startsWith('~pr:')) {
if (config.trigger === '~pr') {
jobs.add(`PR-${config.prNum}:${edge.dest}`);
} else {
jobs.add(edge.dest);
Expand Down
6 changes: 3 additions & 3 deletions test/lib/getNextJobs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ describe('getNextJobs', () => {
['c', 'd']);
// trigger by a pull request on "foo" branch
assert.deepEqual(getNextJobs(specificBranchWorkflow, { trigger: '~pr:foo', prNum: '123' }),
['PR-123:e']);
['e']);
// trigger by a pull request on "foo-bar-dev" branch
assert.deepEqual(getNextJobs(specificBranchWorkflow, { trigger: '~pr:foo-bar-dev',
prNum: '123' }), ['PR-123:f']);
prNum: '123' }), ['f']);
// trigger by a pull request on "bar-foo-prod" branch
assert.deepEqual(getNextJobs(specificBranchWorkflow, { trigger: '~pr:bar-foo-prod',
prNum: '123' }), ['PR-123:f', 'PR-123:g']);
prNum: '123' }), ['f', 'g']);
});
});

0 comments on commit f08d2ff

Please sign in to comment.