pull-request 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47ba8b480d14f0f71f0042798a035228d44c4d9bf7f446555f4af5f092b0747c
4
- data.tar.gz: d33393ceb042ef7c29625712902252091c38b38986dfbe9ddc9b64effc35d7d0
3
+ metadata.gz: 261192d356923a392825fd2fe7d5c35c2ce231c24176744cb2723805c9dd061c
4
+ data.tar.gz: 76f0369668811d60647bef5dfaed3933e23c79c159e87f146c08ac7d5470b03b
5
5
  SHA512:
6
- metadata.gz: ed68a9afa54c9a0bccde8b6b28a6fa75b506d28e0ca1d8ae3664a1e0b6f7aaab5357c6781bf6f9c55ab7f38a2d72f92ce3b9a5bc0dbb6157f0c9df971c35d899
7
- data.tar.gz: ae80c14c3c83c29b03175d237c0f7856b3b00fd8488dc33bbcdf9191fb7fbcf8c89535ccfb435537896d906df5e88db98775ffdadd4d01fcc13b837d49033bfe
6
+ metadata.gz: b3463de3bc7cf7dc0eda769fcb1cf3c633161d00eecd2b51e0006d09ce0c3e9a226cdeccc50722d25b8bcda7922d7ac9790094eb1448a71468599439b307c6b4
7
+ data.tar.gz: e0e855760653160be77eaf4112baedba74cdce3737e26ae6ff0f02ee83542636b7131cd80ac1b088d365bcf05c962f234666d882ccc72ab1836b3de142c65121
@@ -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
@@ -3,7 +3,6 @@ require "optionparser"
3
3
  require "active_support"
4
4
  require "active_support/all"
5
5
 
6
- @estimation = nil
7
6
  @simulate = false
8
7
  @issue_number = nil
9
8
 
@@ -35,11 +34,15 @@ def current_branch
35
34
  sh_get "git rev-parse --abbrev-ref HEAD"
36
35
  end
37
36
 
38
- OptionParser.new do |opts|
39
- opts.banner = "Usage: pr [options] [name]\nDefaults: pr" + File::SEPARATOR
40
- opts.on("-e", "--estimation ESTIMATION", Integer, "Estimated time in hours.") do |e|
41
- @estimation = e.presence
37
+ def issue_json
38
+ @issue_json ||= begin
39
+ error "can't get issue information from GitHub unless the '-i' options is used" unless @issue_number.present?
40
+ JSON.parse(sh_get("gh issue view #{@issue_number} --json title"))
42
41
  end
42
+ end
43
+
44
+ OptionParser.new do |opts|
45
+ opts.banner = "Usage: pr [options] [title]\nDefaults: pr" + File::SEPARATOR
43
46
  opts.on("-s", "--simulate", "Simulate the actions: prints out the write-commands instead of executing them, prefixed with ▶️ .") do
44
47
  @simulate = true
45
48
  end
@@ -48,23 +51,22 @@ OptionParser.new do |opts|
48
51
  end
49
52
  end.parse!
50
53
 
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
54
+ name = @issue_number ? issue_json["title"] : ARGV.join(" ")
55
+ error "Please specify a title for your Pull Request" if name.blank?
62
56
 
63
57
  branch = "feature/"
64
58
  branch += "#{@issue_number}_" if @issue_number
65
59
  branch += name.parameterize.underscore
66
- base_branch = current_branch
67
60
 
61
+ title = name
62
+
63
+ body_lines = []
64
+ path = ".github/pull_request_template.md"
65
+ body_lines.push File.read(path) if File.exists?(path)
66
+ body_lines.push "fixes ##{@issue_number}" if @issue_number
67
+ body = body_lines.join("\n\n")
68
+
69
+ base_branch = current_branch
68
70
  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
71
 
70
72
  puts "Creating new PR for feature '#{title}'"
@@ -73,10 +75,13 @@ puts "Creating branch #{branch}"
73
75
  sh "git checkout -b #{branch}"
74
76
 
75
77
  puts "Creating empty commit"
76
- sh "git commit -m 'initial commit for #{name}' --allow-empty"
78
+ commit_message = "initial commit for #{title}"
79
+ commit_message += ", fixes ##{@issue_number}" if @issue_number
80
+ sh "git commit -m '#{commit_message}' --allow-empty"
77
81
 
78
82
  puts "Pushing to origin"
79
83
  sh "git push -u origin #{branch}"
80
84
 
81
85
  puts "Creating pull request"
82
- sh "hub pull-request -d -m '#{title}' -b #{base_branch}"
86
+ ENV["PR_BODY"] = body_lines.join("\n")
87
+ sh "gh pr create --draft --title '#{title}' --body \"$PR_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.6.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,7 +1,7 @@
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.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Ravens
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-09-21 00:00:00.000000000 Z
12
+ date: 2023-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -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
@@ -92,7 +94,7 @@ 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
97
+ rubygems_version: 3.3.7
96
98
  signing_key:
97
99
  specification_version: 4
98
100
  summary: Automatically create PRs for GitHub Flow