@holidaycheck/liam-tasks
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -28,3 +28,3 @@ # Task `auto-merge-pull-request` | ||
* **What is this `mergeable_state` field in pull request response? I cannot find this in API docs | ||
* What is this `mergeable_state` field in pull request response? I cannot find this in API docs | ||
@@ -41,2 +41,2 @@ This value is undocumented, here's the excerpt from GitHub Support: | ||
Basically, we're interested only in `mergeable_state === clean` | ||
Basically, we're interested only in `mergeable_state === clean|unstable` |
{ | ||
"name": "@holidaycheck/liam-tasks", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Set of automation tasks for `liam`", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/holidaycheck/liam-tasks", |
@@ -67,3 +67,3 @@ const R = require('ramda'); | ||
.then((pullRequestData) => { | ||
if (pullRequestData.mergeable_state === 'clean') { | ||
if (pullRequestData.mergeable_state.match(/^(clean|unstable)$/)) { | ||
return mergePullRequest(githubClient, repository, pullRequestData) | ||
@@ -70,0 +70,0 @@ .then(commentOnPullRequest.bind(null, githubClient, label, repository)) |
@@ -29,3 +29,3 @@ const expect = require('chai').expect; | ||
it('should merge pull request that fulfils merge criteria', () => { | ||
it('should merge pull request with status "clean"', () => { | ||
const logger = createLogger(); | ||
@@ -82,2 +82,26 @@ const repository = { owner: 'foo', name: 'bar' }; | ||
it('should merge pull request with status "unstable"', () => { | ||
const logger = createLogger(); | ||
const repository = { owner: 'foo', name: 'bar' }; | ||
const label = 'merge-me-please'; | ||
const githubClient = createGithubClient(); | ||
githubClient.gitdata.deleteReference.resolves(); | ||
githubClient.issues.createComment.resolves(); | ||
githubClient.pullRequests.get.resolves({ data: { | ||
head: { ref: 'feature-branch' }, | ||
mergeable_state: 'unstable' | ||
} }); | ||
githubClient.pullRequests.merge.resolves(); | ||
githubClient.search.issues.resolves({ data: { items: [ { number: 1337 } ] } }); | ||
return autoMergePullRequest(logger, { githubClient, label, repository }).then(() => { | ||
expect(githubClient.search.issues).to.have.been.calledOnce; | ||
expect(githubClient.pullRequests.get).to.have.been.calledOnce; | ||
expect(githubClient.pullRequests.merge).to.have.been.calledOnce; | ||
expect(githubClient.issues.createComment).to.have.been.calledOnce; | ||
expect(githubClient.gitdata.deleteReference).to.have.been.calledOnce; | ||
expect(logger.log).to.have.been.calledOnce; | ||
}); | ||
}); | ||
it('should not merge anything when there\'s no matching pull request found', () => { | ||
@@ -129,3 +153,3 @@ const logger = createLogger(); | ||
it('should not try to merge non-mergeable pull request', () => { | ||
const ignoredStates = [ 'dirty', 'unknown', 'blocked', 'behind', 'unstable', 'has_hooks', 'foobar' ]; | ||
const ignoredStates = [ 'dirty', 'unknown', 'blocked', 'behind', 'has_hooks', 'foobar' ]; | ||
const createTestCaseForMergeableState = (state) => { | ||
@@ -132,0 +156,0 @@ const logger = createLogger(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45287
795