Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pull request title to worker #131

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/travis/scheduler/serialize/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def job_data
pull_request_head_branch: request.pull_request_head_ref,
pull_request_head_sha: request.pull_request_head_sha,
pull_request_head_slug: request.pull_request_head_slug,
pull_request_title: request.pull_request_title,
)
end
data
Expand Down
4 changes: 4 additions & 0 deletions lib/travis/scheduler/serialize/worker/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ def pull_request_head_slug
pull_request ? pull_request.head_repo_slug : pull_request_head_repo['full_name']
end

def pull_request_title
pull_request ? pull_request.title : pull_request_head['title']
end

private

# TODO remove once we've backfilled the pull_requests table
Expand Down
3 changes: 2 additions & 1 deletion spec/travis/scheduler/serialize/worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def encrypted(value)
let(:ref) { 'refs/pull/180/merge' }
let(:pr_number) { 180 }
let(:payload) { { 'pull_request' => { 'head' => { 'ref' => 'head_branch', 'sha' => '62aaef', 'repo' => {'full_name' => 'travis-ci/gem-release'} } } } }
let(:pull_request) { PullRequest.create(head_ref: 'head_branch', head_repo_slug: 'travis-ci/gem-release') }
let(:pull_request) { PullRequest.create(head_ref: 'head_branch', head_repo_slug: 'travis-ci/gem-release', title: 'Awesome pull request') }

before { request.update_attributes(pull_request: pull_request, base_commit: '0cd9ff', head_commit: '62aaef') }

Expand Down Expand Up @@ -235,6 +235,7 @@ def encrypted(value)
pull_request_head_branch: 'head_branch',
pull_request_head_sha: '62aaef',
pull_request_head_slug: 'travis-ci/gem-release',
pull_request_title: 'Awesome pull request',
allow_failure: allow_failure,
stage_name: nil,
name: 'jobname',
Expand Down