Include PR title in change message
Gerrit includes the whole commit message (subject + body). For a GitHub PR only the body was included in the change message. This patch adds also the PR title to the change message so we have a similar behavior for GitHub. Change-Id: I662e6898cb52b73e0341512b7bffe7f858552dda
This commit is contained in:
parent
a1283f403f
commit
47d55215aa
|
@ -36,7 +36,9 @@ class TestGithubDriver(ZuulTestCase):
|
|||
def test_pull_event(self):
|
||||
self.executor_server.hold_jobs_in_build = True
|
||||
|
||||
A = self.fake_github.openFakePullRequest('org/project', 'master', 'A')
|
||||
body = "This is the\nPR body."
|
||||
A = self.fake_github.openFakePullRequest('org/project', 'master', 'A',
|
||||
body=body)
|
||||
self.fake_github.emitEvent(A.getPullRequestOpenedEvent())
|
||||
self.waitUntilSettled()
|
||||
|
||||
|
@ -56,6 +58,7 @@ class TestGithubDriver(ZuulTestCase):
|
|||
self.assertEqual('master', zuulvars['branch'])
|
||||
self.assertEquals('https://github.com/org/project/pull/1',
|
||||
zuulvars['items'][0]['change_url'])
|
||||
self.assertEqual(zuulvars["message"], "A\n\n{}".format(body))
|
||||
self.assertEqual(1, len(A.comments))
|
||||
self.assertThat(
|
||||
A.comments[0],
|
||||
|
|
|
@ -936,7 +936,13 @@ class GithubConnection(BaseConnection):
|
|||
change.number)
|
||||
change.labels = change.pr.get('labels')
|
||||
# ensure message is at least an empty string
|
||||
change.message = change.pr.get('body') or ''
|
||||
message = change.pr.get("body") or ""
|
||||
if change.title:
|
||||
if message:
|
||||
message = "{}\n\n{}".format(change.title, message)
|
||||
else:
|
||||
message = change.title
|
||||
change.message = message
|
||||
|
||||
# Note(tobiash): The updated_at timestamp is a moving target that is
|
||||
# not bound to the pull request 'version' we can solve that by just not
|
||||
|
|
Loading…
Reference in New Issue