pull-request 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47ba8b480d14f0f71f0042798a035228d44c4d9bf7f446555f4af5f092b0747c
4
- data.tar.gz: d33393ceb042ef7c29625712902252091c38b38986dfbe9ddc9b64effc35d7d0
3
+ metadata.gz: 47bc3713218fc982a1c0194c811be0c87c6b10689b6724644fc786c00b14dad3
4
+ data.tar.gz: cb56af729482bfe0836989ba9365f7538c4c8265410c3088a21ca7ffdcd259b4
5
5
  SHA512:
6
- metadata.gz: ed68a9afa54c9a0bccde8b6b28a6fa75b506d28e0ca1d8ae3664a1e0b6f7aaab5357c6781bf6f9c55ab7f38a2d72f92ce3b9a5bc0dbb6157f0c9df971c35d899
7
- data.tar.gz: ae80c14c3c83c29b03175d237c0f7856b3b00fd8488dc33bbcdf9191fb7fbcf8c89535ccfb435537896d906df5e88db98775ffdadd4d01fcc13b837d49033bfe
6
+ metadata.gz: b64964a0ad5ffa1b04a537ed53a1cbe1eb3f893a348e20856b5bac2f3473eee239a763b16457b97a6063f4bec99ec4577cd70a45014355df568af9a03f06c2f8
7
+ data.tar.gz: bf3a4d8b62903d52470c6807cc2eb94a41c2c85ccc5b2b8964c40bc0d7c450434b8b1a5f6fd89090047c7e21d00b9116d35e9185f3c7b0fd45af18376434241c
@@ -0,0 +1,16 @@
1
+ name: Publish to RubyGems
2
+ on:
3
+ release:
4
+ types: [created]
5
+ jobs:
6
+ gem:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ - run: sed -i "s/0.0.1/$(echo $GITHUB_REF_NAME | cut -c 2-)/" pullrequest.gemspec
13
+ - name: Publish gem
14
+ uses: dawidd6/action-publish-gem@v1
15
+ with:
16
+ api_key: ${{secrets.RUBYGEMS_API_KEY}}
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.2
data/README.md CHANGED
@@ -6,12 +6,12 @@ Automatically branch and create an empty pull request, automating an early-revie
6
6
 
7
7
  ### Requirements
8
8
 
9
- #### hub
9
+ #### GitHub CLI
10
10
 
11
- [GitHub's `hub`](https://hub.github.com/) CLI tool is required. On macOS, simply install it through _HomeBrew_
11
+ [GitHub's CLI](https://cli.github.com//) (aka `gh`) is required. On _macOS_, simply install it through _HomeBrew_.
12
12
 
13
13
  ```bash
14
- brew install hub
14
+ brew install gh
15
15
  ```
16
16
 
17
17
  ### Installing pr (pull-request) as part of your application
@@ -34,7 +34,7 @@ Install it yourself as:
34
34
 
35
35
  ```bash
36
36
  gem install pull-request
37
- ````
37
+ ```
38
38
 
39
39
  ## Usage
40
40
 
@@ -69,8 +69,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
69
69
 
70
70
  Bug reports and pull requests are welcome on GitHub at https://github.com/Jens Ravens/pullrequest. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
71
71
 
72
-
73
72
  ## License
74
73
 
75
74
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
76
-
data/exe/pr CHANGED
@@ -35,8 +35,15 @@ def current_branch
35
35
  sh_get "git rev-parse --abbrev-ref HEAD"
36
36
  end
37
37
 
38
+ def issue_json
39
+ @issue_json ||= begin
40
+ error "can't get issue information from GitHub unless the '-i' options is used" unless @issue_number.present?
41
+ JSON.parse(sh_get("gh issue view #{@issue_number} --json title"))
42
+ end
43
+ end
44
+
38
45
  OptionParser.new do |opts|
39
- opts.banner = "Usage: pr [options] [name]\nDefaults: pr" + File::SEPARATOR
46
+ opts.banner = "Usage: pr [options] [title]\nDefaults: pr" + File::SEPARATOR
40
47
  opts.on("-e", "--estimation ESTIMATION", Integer, "Estimated time in hours.") do |e|
41
48
  @estimation = e.presence
42
49
  end
@@ -48,23 +55,21 @@ OptionParser.new do |opts|
48
55
  end
49
56
  end.parse!
50
57
 
51
- name =
52
- if @issue_number
53
- sh_get("hub issue show #{@issue_number} -f %t")
54
- else
55
- ARGV.join(" ")
56
- end
57
- error "Please specify a name for your Pull Request" if name.blank?
58
-
59
- title = name
60
- title += " [#{@estimation}]" if @estimation
61
- title += "\n\nfixes ##{@issue_number}" if @issue_number
58
+ name = @issue_number ? issue_json["title"] : ARGV.join(" ")
59
+ error "Please specify a title for your Pull Request" if name.blank?
62
60
 
63
61
  branch = "feature/"
64
62
  branch += "#{@issue_number}_" if @issue_number
65
63
  branch += name.parameterize.underscore
66
- base_branch = current_branch
67
64
 
65
+ title = name
66
+ title += " [#{@estimation}]" if @estimation
67
+
68
+ body_lines = []
69
+ body_lines.push "fixes ##{@issue_number}" if @issue_number
70
+ body = body_lines.join("\n")
71
+
72
+ base_branch = current_branch
68
73
  exit 1 unless ["master", "main", "develop"].include?(base_branch) || confirm("Your base branch #{base_branch} doesn't seem to be a common base branch name. Do you want to continue?")
69
74
 
70
75
  puts "Creating new PR for feature '#{title}'"
@@ -73,10 +78,10 @@ puts "Creating branch #{branch}"
73
78
  sh "git checkout -b #{branch}"
74
79
 
75
80
  puts "Creating empty commit"
76
- sh "git commit -m 'initial commit for #{name}' --allow-empty"
81
+ sh "git commit -m 'initial commit for #{title}' --allow-empty"
77
82
 
78
83
  puts "Pushing to origin"
79
84
  sh "git push -u origin #{branch}"
80
85
 
81
86
  puts "Creating pull request"
82
- sh "hub pull-request -d -m '#{title}' -b #{base_branch}"
87
+ sh "gh pr create --draft --title '#{title}' --body '#{body}' --base #{base_branch}"
data/pullrequest.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "pull-request"
4
- spec.version = "0.4.0"
4
+ spec.version = "0.5.0"
5
5
  spec.authors = ["Jens Ravens", "David Dufour-Boivin"]
6
6
  spec.email = ["jens@nerdgeschoss.de", "david@nerdgeschoss.de"]
7
7
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pull-request
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Ravens
8
8
  - David Dufour-Boivin
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-09-21 00:00:00.000000000 Z
12
+ date: 2022-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -53,7 +53,7 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
- description:
56
+ description:
57
57
  email:
58
58
  - jens@nerdgeschoss.de
59
59
  - david@nerdgeschoss.de
@@ -62,8 +62,10 @@ executables:
62
62
  extensions: []
63
63
  extra_rdoc_files: []
64
64
  files:
65
+ - ".github/workflows/publish.yml"
65
66
  - ".gitignore"
66
67
  - ".rubocop.yml"
68
+ - ".ruby-version"
67
69
  - CODE_OF_CONDUCT.md
68
70
  - Gemfile
69
71
  - LICENSE.txt
@@ -77,7 +79,7 @@ homepage: https://nerdgeschoss.de
77
79
  licenses:
78
80
  - MIT
79
81
  metadata: {}
80
- post_install_message:
82
+ post_install_message:
81
83
  rdoc_options: []
82
84
  require_paths:
83
85
  - lib
@@ -92,8 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
94
  - !ruby/object:Gem::Version
93
95
  version: '0'
94
96
  requirements: []
95
- rubygems_version: 3.0.6
96
- signing_key:
97
+ rubygems_version: 3.3.7
98
+ signing_key:
97
99
  specification_version: 4
98
100
  summary: Automatically create PRs for GitHub Flow
99
101
  test_files: []