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

replace WIP PRs with draft PRs #39

Merged
merged 2 commits into from
May 10, 2019
Merged
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
4 changes: 3 additions & 1 deletion lib/cp8_cli/github/pull_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def save
to,
from,
title,
body
body,
draft: true,
accept: "application/vnd.github.shadow-cat-preview" # waiting for https://github.com/octokit/octokit.rb/pull/1114
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove this now, seems like octokit/octokit.rb#1114 was already merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 will take a look in a subsequent PR.

)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/cp8_cli/pull_request_title.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Cp8Cli
class PullRequestTitle
def initialize(title, prefixes: [])
@title = title
@prefixes = Array(*prefixes)
@prefixes = Array(prefixes)
end

def run
Expand Down
8 changes: 4 additions & 4 deletions lib/cp8_cli/story.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ def start
checkout_branch
create_empty_commit
push_branch
create_wip_pull_request
create_draft_pull_request
assign
Command.title "Created WIP PR, run `cp8 open` to view."
Command.title "Created draft PR, run `cp8 open` to view."
end

private
Expand All @@ -33,10 +33,10 @@ def push_branch
branch.push
end

def create_wip_pull_request
def create_draft_pull_request
Github::PullRequest.create(
from: branch.name,
title: PullRequestTitle.new(title, prefixes: :wip).run,
title: PullRequestTitle.new(title).run,
body: PullRequestBody.new(self).run
)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cp8_cli/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Cp8Cli
VERSION = "8.2.1"
VERSION = "9.0.0"

class Version
def self.latest?
Expand Down
9 changes: 5 additions & 4 deletions test/main_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def setup

def test_start_adhoc_story
pr_endpoint = stub_github(:post, "/repos/balvig/cp8_cli/pulls").
with(body: { base: "master", head: "jb/fix-bug", title: "[WIP] Fix bug" })
with(body: { base: "master", head: "jb/fix-bug", title: "Fix bug", draft: true })

stub_github_user("John Bobson")
stub_repo("git@github.com:balvig/cp8_cli.git")
Expand All @@ -19,7 +19,7 @@ def test_start_adhoc_story
expect_checkout("jb/fix-bug")
expect_commit("Fix bug")
expect_push("jb/fix-bug")
expect_title "Created WIP PR, run `cp8 open` to view."
expect_title "Created draft PR, run `cp8 open` to view."

cli.start("Fix bug")

Expand All @@ -38,8 +38,9 @@ def test_start_github_issue
body: {
base: "master",
head: "jb/issue-title",
title: "[WIP] ISSUE TITLE",
title: "ISSUE TITLE",
body: "Closes balvig/cp8_cli#ISSUE_NUMBER\n\n_Release note: ISSUE TITLE_",
draft: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
)

Expand All @@ -54,7 +55,7 @@ def test_start_github_issue
expect_checkout("jb/issue-title")
expect_commit("ISSUE TITLE")
expect_push("jb/issue-title")
expect_title "Created WIP PR, run `cp8 open` to view."
expect_title "Created draft PR, run `cp8 open` to view."

cli.start("https://github.com/balvig/cp8_cli/issues/ISSUE_NUMBER")

Expand Down