Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bafe967

Browse files
committed
Merge pull request github#1018 from DanielDraganov/master
Fix: Kanbanize service fails for :issues and :issue_comment events
2 parents d395f0c + af0ac53 commit bafe967

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/services/kanbanize.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ def receive_event
2929
issues_board_id = data['project_issues_board_id'].to_s
3030

3131
# check the branch restriction is poplulated and branch is not included
32-
branch = payload['ref'].split('/').last
33-
if branch_restriction.length > 0 && branch_restriction.index(branch) == nil
34-
return
32+
if event.to_s == 'push'
33+
branch = payload['ref'].split('/').last
34+
if branch_restriction.length > 0 && branch_restriction.index(branch) == nil
35+
return
36+
end
3537
end
3638

3739
http_post "http://#{domain_name}/index.php/api/kanbanize/git_hub_event",

test/kanbanize_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_push_with_issue_tracking
4646
@stubs.post url do |env|
4747
assert_equal 'testdomain.kanbanize.com', env[:url].host
4848
assert_equal '/index.php/api/kanbanize/git_hub_event', env[:url].request_uri
49-
assert_equal %({"ref":"refs/heads/mybranch2"}), env[:body]
49+
assert_equal %({"action":"created"}), env[:body]
5050
assert_equal 'a1b2c3==', env[:request_headers]['apikey']
5151
assert_equal '', env[:request_headers]['branch-filter']
5252
assert_equal false, env[:request_headers]['last-commit']
@@ -55,7 +55,7 @@ def test_push_with_issue_tracking
5555
[200, {}, '']
5656
end
5757

58-
svc = service({'kanbanize_domain_name' => 'testdomain.kanbanize.com', 'kanbanize_api_key' => 'a1b2c3==', 'track_project_issues_in_kanbanize' => '1', 'project_issues_board_id' => '131'}, {'ref' => 'refs/heads/mybranch2'})
58+
svc = service(:issues, {'kanbanize_domain_name' => 'testdomain.kanbanize.com', 'kanbanize_api_key' => 'a1b2c3==', 'track_project_issues_in_kanbanize' => '1', 'project_issues_board_id' => '131'}, {'action' => 'created'})
5959
svc.receive_event
6060
end
6161

0 commit comments

Comments
 (0)