git-pr-release 1.9.0 → 2.1.1
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 +4 -4
 - data/.github/workflows/test.yml +47 -0
 - data/CHANGELOG.md +24 -0
 - data/README.md +10 -0
 - data/git-pr-release.gemspec +1 -1
 - data/lib/git/pr/release/cli.rb +54 -9
 - data/lib/git/pr/release/pull_request.rb +6 -2
 - data/spec/git/pr/release/cli_spec.rb +8 -8
 - data/spec/git/pr/release_spec.rb +6 -6
 - data/spec/support/file_fixture_support.rb +8 -0
 - metadata +4 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: fb2e505f8c5478aa78d16885c34a3a90d5f23ae2955d1438d38063091f810416
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 541065dedc6efd40d708c325be8e73a0d40b91a1816b3bb468d192383f4a4717
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 9b99c927c9bfec3ec71d74f4b4e6e1eaca5b5ccaae2a184c0567f34a3a1859e0464dfa2b77c2995b3dd56239ed4b5647ef0878a9dc9936c8b02dfdffcb161681
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 73bc08b35bbf9ce89e4270e0b660f6d71b17f65a578f8363d4a6f6741be8505660cee77a9bdba111f79fd15298930000e72aee6e4cd4ef6dfec77496cfcf5ac3
         
     | 
| 
         @@ -0,0 +1,47 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            name: test
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            on:
         
     | 
| 
      
 4 
     | 
    
         
            +
              push:
         
     | 
| 
      
 5 
     | 
    
         
            +
                branches:
         
     | 
| 
      
 6 
     | 
    
         
            +
                  - master
         
     | 
| 
      
 7 
     | 
    
         
            +
              pull_request:
         
     | 
| 
      
 8 
     | 
    
         
            +
              schedule:
         
     | 
| 
      
 9 
     | 
    
         
            +
                - cron: "0 0 * * *" # JST 09:00
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            jobs:
         
     | 
| 
      
 12 
     | 
    
         
            +
              test:
         
     | 
| 
      
 13 
     | 
    
         
            +
                runs-on: ubuntu-latest
         
     | 
| 
      
 14 
     | 
    
         
            +
                container: ${{ matrix.ruby }}
         
     | 
| 
      
 15 
     | 
    
         
            +
                strategy:
         
     | 
| 
      
 16 
     | 
    
         
            +
                  fail-fast: false
         
     | 
| 
      
 17 
     | 
    
         
            +
                  matrix:
         
     | 
| 
      
 18 
     | 
    
         
            +
                    ruby:
         
     | 
| 
      
 19 
     | 
    
         
            +
                      - ruby:2.6
         
     | 
| 
      
 20 
     | 
    
         
            +
                      - ruby:2.7
         
     | 
| 
      
 21 
     | 
    
         
            +
                      - ruby:3.0
         
     | 
| 
      
 22 
     | 
    
         
            +
                      - rubylang/ruby:master-nightly-bionic
         
     | 
| 
      
 23 
     | 
    
         
            +
                    include:
         
     | 
| 
      
 24 
     | 
    
         
            +
                      - ruby: rubylang/ruby:master-nightly-bionic
         
     | 
| 
      
 25 
     | 
    
         
            +
                        allow_failures: "true"
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                steps:
         
     | 
| 
      
 28 
     | 
    
         
            +
                  - uses: actions/checkout@v2
         
     | 
| 
      
 29 
     | 
    
         
            +
                  - name: Cache vendor/bundle
         
     | 
| 
      
 30 
     | 
    
         
            +
                    uses: actions/cache@v2
         
     | 
| 
      
 31 
     | 
    
         
            +
                    with:
         
     | 
| 
      
 32 
     | 
    
         
            +
                      path: vendor/bundle
         
     | 
| 
      
 33 
     | 
    
         
            +
                      key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ github.sha }}
         
     | 
| 
      
 34 
     | 
    
         
            +
                      restore-keys: |
         
     | 
| 
      
 35 
     | 
    
         
            +
                        v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
         
     | 
| 
      
 36 
     | 
    
         
            +
                    continue-on-error: ${{ matrix.allow_failures == 'true' }}
         
     | 
| 
      
 37 
     | 
    
         
            +
                  - name: bundle update
         
     | 
| 
      
 38 
     | 
    
         
            +
                    run: |
         
     | 
| 
      
 39 
     | 
    
         
            +
                      set -xe
         
     | 
| 
      
 40 
     | 
    
         
            +
                      bundle config path vendor/bundle
         
     | 
| 
      
 41 
     | 
    
         
            +
                      bundle update --jobs $(nproc) --retry 3
         
     | 
| 
      
 42 
     | 
    
         
            +
                    continue-on-error: ${{ matrix.allow_failures == 'true' }}
         
     | 
| 
      
 43 
     | 
    
         
            +
                  - name: Run ${{ matrix.test_framework }}
         
     | 
| 
      
 44 
     | 
    
         
            +
                    run: |
         
     | 
| 
      
 45 
     | 
    
         
            +
                      set -xe
         
     | 
| 
      
 46 
     | 
    
         
            +
                      bundle exec rspec
         
     | 
| 
      
 47 
     | 
    
         
            +
                    continue-on-error: ${{ matrix.allow_failures == 'true' }}
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,5 +1,29 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # git-pr-release
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            ## v2.1.1 (2022-03-09)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            [full changelog](https://github.com/x-motemen/git-pr-release/compare/v2.1.0...v2.1.1)
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            * (#81) fix forbidden git config name (#80) (@mtgto)
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## v2.1.0 (2022-03-03)
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            [full changelog](https://github.com/x-motemen/git-pr-release/compare/v2.0.0...v2.1.0)
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            * (#75) reduce GitHub search API calls when the squashed option is specified (@Songmu)
         
     | 
| 
      
 14 
     | 
    
         
            +
            * (#76) use bulk issue search to reduce API calls (@Songmu)
         
     | 
| 
      
 15 
     | 
    
         
            +
            * (#77) Add option "ssl_no_verify" to skip verifying ssl certificate (@mtgto)
         
     | 
| 
      
 16 
     | 
    
         
            +
            * (#78) add an argument to to_checklist_item to print pr title (@mtgto)
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            ## v2.0.0 (2022-02-17)
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            [full changelog](https://github.com/x-motemen/git-pr-release/compare/v1.9.0...v2.0.0)
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            * (#69) remove duplicated PR entries at squash (@Yuki-Inoue)
         
     | 
| 
      
 23 
     | 
    
         
            +
            * (#70) [Spec] Fix spec for build_pr_title_and_body (@yutailang0119)
         
     | 
| 
      
 24 
     | 
    
         
            +
            * (#71) Introduce CI (@ohbarye)
         
     | 
| 
      
 25 
     | 
    
         
            +
            * (#73) (#74) Use `YAML.unsafe_load_file` instead of `YAML.load_file` (@ohbarye)
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
       3 
27 
     | 
    
         
             
            ## v1.9.0 (2021-08-04)
         
     | 
| 
       4 
28 
     | 
    
         | 
| 
       5 
29 
     | 
    
         
             
            [full changelog](https://github.com/x-motemen/git-pr-release/compare/v1.8.0...v1.9.0)
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -84,6 +84,16 @@ You can specify this value by `GIT_PR_RELEASE_MENTION` environment variable. 
     | 
|
| 
       84 
84 
     | 
    
         | 
| 
       85 
85 
     | 
    
         
             
            If not specified, the mention will be the PR assignee
         
     | 
| 
       86 
86 
     | 
    
         | 
| 
      
 87 
     | 
    
         
            +
            ### `pr-release.ssl-no-verify`
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            Whether to verify SSL certificate or not.
         
     | 
| 
      
 90 
     | 
    
         
            +
            Accepted values: `true` | `false`
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
            This option might be useful when self-hosted GitHub enterprise server is using self-signed certificate.
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
            You can specify this value by `GIT_PR_RELEASE_SSL_NO_VERIFY` to `1`.
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
            If not specified, verify SSL certificate always.
         
     | 
| 
       87 
97 
     | 
    
         | 
| 
       88 
98 
     | 
    
         
             
            Errors and exit statuses
         
     | 
| 
       89 
99 
     | 
    
         
             
            ------------------------
         
     | 
    
        data/git-pr-release.gemspec
    CHANGED
    
    | 
         @@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            Gem::Specification.new do |spec|
         
     | 
| 
       6 
6 
     | 
    
         
             
              spec.name          = "git-pr-release"
         
     | 
| 
       7 
     | 
    
         
            -
              spec.version       = '1. 
     | 
| 
      
 7 
     | 
    
         
            +
              spec.version       = '2.1.1'
         
     | 
| 
       8 
8 
     | 
    
         
             
              spec.authors       = ["motemen"]
         
     | 
| 
       9 
9 
     | 
    
         
             
              spec.email         = ["motemen@gmail.com"]
         
     | 
| 
       10 
10 
     | 
    
         
             
              spec.summary       = 'Creates a release pull request'
         
     | 
    
        data/lib/git/pr/release/cli.rb
    CHANGED
    
    | 
         @@ -59,8 +59,12 @@ module Git 
     | 
|
| 
       59 
59 
     | 
    
         
             
                      host, @repository, scheme = host_and_repository_and_scheme
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
61 
     | 
    
         
             
                      if host
         
     | 
| 
       62 
     | 
    
         
            -
                        # GitHub 
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
      
 62 
     | 
    
         
            +
                        if scheme == 'https' # GitHub Enterprise
         
     | 
| 
      
 63 
     | 
    
         
            +
                          ssl_no_verify = %w[true 1].include? ENV.fetch('GIT_PR_RELEASE_SSL_NO_VERIFY') { git_config('ssl-no-verify') }
         
     | 
| 
      
 64 
     | 
    
         
            +
                          if ssl_no_verify
         
     | 
| 
      
 65 
     | 
    
         
            +
                            OpenSSL::SSL.const_set :VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE
         
     | 
| 
      
 66 
     | 
    
         
            +
                          end
         
     | 
| 
      
 67 
     | 
    
         
            +
                        end
         
     | 
| 
       64 
68 
     | 
    
         | 
| 
       65 
69 
     | 
    
         
             
                        Octokit.configure do |c|
         
     | 
| 
       66 
70 
     | 
    
         
             
                          c.api_endpoint = "#{scheme}://#{host}/api/v3"
         
     | 
| 
         @@ -85,9 +89,12 @@ module Git 
     | 
|
| 
       85 
89 
     | 
    
         
             
                    def fetch_merged_prs
         
     | 
| 
       86 
90 
     | 
    
         
             
                      git :remote, 'update', 'origin' unless @no_fetch
         
     | 
| 
       87 
91 
     | 
    
         | 
| 
       88 
     | 
    
         
            -
                      merged_pull_request_numbers =  
     | 
| 
      
 92 
     | 
    
         
            +
                      merged_pull_request_numbers = fetch_merged_pr_numbers_from_git_remote
         
     | 
| 
      
 93 
     | 
    
         
            +
                      if @squashed
         
     | 
| 
      
 94 
     | 
    
         
            +
                        merged_pull_request_numbers.concat(fetch_squash_merged_pr_numbers_from_github)
         
     | 
| 
      
 95 
     | 
    
         
            +
                      end
         
     | 
| 
       89 
96 
     | 
    
         | 
| 
       90 
     | 
    
         
            -
                      merged_prs = merged_pull_request_numbers.sort.map do |nr|
         
     | 
| 
      
 97 
     | 
    
         
            +
                      merged_prs = merged_pull_request_numbers.uniq.sort.map do |nr|
         
     | 
| 
       91 
98 
     | 
    
         
             
                        pr = client.pull_request repository, nr
         
     | 
| 
       92 
99 
     | 
    
         
             
                        say "To be released: ##{pr.number} #{pr.title}", :notice
         
     | 
| 
       93 
100 
     | 
    
         
             
                        pr
         
     | 
| 
         @@ -122,11 +129,49 @@ module Git 
     | 
|
| 
       122 
129 
     | 
    
         
             
                      end.compact
         
     | 
| 
       123 
130 
     | 
    
         
             
                    end
         
     | 
| 
       124 
131 
     | 
    
         | 
| 
       125 
     | 
    
         
            -
                    def  
     | 
| 
       126 
     | 
    
         
            -
                       
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
     | 
    
         
            -
                       
     | 
| 
      
 132 
     | 
    
         
            +
                    def search_issue_numbers(query)
         
     | 
| 
      
 133 
     | 
    
         
            +
                      sleep 1
         
     | 
| 
      
 134 
     | 
    
         
            +
                      say "search issues with query:#{query}", :debug
         
     | 
| 
      
 135 
     | 
    
         
            +
                      # Fortunately, we don't need to take care of the page count in response, because
         
     | 
| 
      
 136 
     | 
    
         
            +
                      # the default value of per_page is 30 and we can't specify more than 30 commits due to
         
     | 
| 
      
 137 
     | 
    
         
            +
                      # the length limit specification of the query string.
         
     | 
| 
      
 138 
     | 
    
         
            +
                      client.search_issues("#{query}")[:items].map(&:number)
         
     | 
| 
      
 139 
     | 
    
         
            +
                    end
         
     | 
| 
      
 140 
     | 
    
         
            +
             
     | 
| 
      
 141 
     | 
    
         
            +
                    def fetch_squash_merged_pr_numbers_from_github
         
     | 
| 
      
 142 
     | 
    
         
            +
                      # When "--abbrev" is specified, the length of the each line of the stdout isn't fixed.
         
     | 
| 
      
 143 
     | 
    
         
            +
                      # It is just a minimum length, and if the commit cannot be uniquely identified with
         
     | 
| 
      
 144 
     | 
    
         
            +
                      # that length, a longer commit hash will be displayed.
         
     | 
| 
      
 145 
     | 
    
         
            +
                      # We specify this option to minimize the length of the query string, but we use
         
     | 
| 
      
 146 
     | 
    
         
            +
                      # "--abbrev=7" because the SHA syntax of the search API requires a string of at
         
     | 
| 
      
 147 
     | 
    
         
            +
                      # least 7 characters.
         
     | 
| 
      
 148 
     | 
    
         
            +
                      # ref. https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests#search-by-commit-sha
         
     | 
| 
      
 149 
     | 
    
         
            +
                      # This is done because there is a length limit on the API query string, and we want
         
     | 
| 
      
 150 
     | 
    
         
            +
                      # to create a string with the minimum possible length.
         
     | 
| 
      
 151 
     | 
    
         
            +
                      shas = git(:log, '--pretty=format:%h', "--abbrev=7", "--no-merges", "--first-parent",
         
     | 
| 
      
 152 
     | 
    
         
            +
                        "origin/#{production_branch}..origin/#{staging_branch}").map(&:chomp)
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
                      pr_nums = []
         
     | 
| 
      
 155 
     | 
    
         
            +
                      query_base = "repo:#{repository} is:pr is:closed"
         
     | 
| 
      
 156 
     | 
    
         
            +
                      query = query_base
         
     | 
| 
      
 157 
     | 
    
         
            +
                      # Make bulk requests with multiple SHAs of the maximum possible length.
         
     | 
| 
      
 158 
     | 
    
         
            +
                      # If multiple SHAs are specified, the issue search API will treat it like an OR search,
         
     | 
| 
      
 159 
     | 
    
         
            +
                      # and all the pull requests will be searched.
         
     | 
| 
      
 160 
     | 
    
         
            +
                      # This is difficult to read from the current documentation, but that is the current
         
     | 
| 
      
 161 
     | 
    
         
            +
                      # behavior and GitHub support has responded that this is the spec.
         
     | 
| 
      
 162 
     | 
    
         
            +
                      shas.each do |sha|
         
     | 
| 
      
 163 
     | 
    
         
            +
                        # Longer than 256 characters are not supported in the query.
         
     | 
| 
      
 164 
     | 
    
         
            +
                        # ref. https://docs.github.com/en/rest/reference/search#limitations-on-query-length
         
     | 
| 
      
 165 
     | 
    
         
            +
                        if query.length + 1 + sha.length >= 256
         
     | 
| 
      
 166 
     | 
    
         
            +
                          pr_nums.concat(search_issue_numbers(query))
         
     | 
| 
      
 167 
     | 
    
         
            +
                          query = query_base
         
     | 
| 
      
 168 
     | 
    
         
            +
                        end
         
     | 
| 
      
 169 
     | 
    
         
            +
                        query += " " + sha
         
     | 
| 
      
 170 
     | 
    
         
            +
                      end
         
     | 
| 
      
 171 
     | 
    
         
            +
                      if query != query_base
         
     | 
| 
      
 172 
     | 
    
         
            +
                          pr_nums.concat(search_issue_numbers(query))
         
     | 
| 
      
 173 
     | 
    
         
            +
                      end
         
     | 
| 
      
 174 
     | 
    
         
            +
                      pr_nums
         
     | 
| 
       130 
175 
     | 
    
         
             
                    end
         
     | 
| 
       131 
176 
     | 
    
         | 
| 
       132 
177 
     | 
    
         
             
                    def create_release_pr(merged_prs)
         
     | 
| 
         @@ -10,8 +10,12 @@ module Git 
     | 
|
| 
       10 
10 
     | 
    
         
             
                      @pr = pr
         
     | 
| 
       11 
11 
     | 
    
         
             
                    end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                    def to_checklist_item
         
     | 
| 
       14 
     | 
    
         
            -
                       
     | 
| 
      
 13 
     | 
    
         
            +
                    def to_checklist_item(print_title = false)
         
     | 
| 
      
 14 
     | 
    
         
            +
                      if print_title
         
     | 
| 
      
 15 
     | 
    
         
            +
                        "- [ ] ##{pr.number} #{pr.title}" + mention
         
     | 
| 
      
 16 
     | 
    
         
            +
                      else
         
     | 
| 
      
 17 
     | 
    
         
            +
                        "- [ ] ##{pr.number}" + mention
         
     | 
| 
      
 18 
     | 
    
         
            +
                      end
         
     | 
| 
       15 
19 
     | 
    
         
             
                    end
         
     | 
| 
       16 
20 
     | 
    
         | 
| 
       17 
21 
     | 
    
         
             
                    def html_link
         
     | 
| 
         @@ -36,8 +36,8 @@ RSpec.describe Git::Pr::Release::CLI do 
     | 
|
| 
       36 
36 
     | 
    
         
             
                      conn.builder.handlers.delete(Faraday::Adapter::NetHttp)
         
     | 
| 
       37 
37 
     | 
    
         
             
                      conn.adapter(:test, Faraday::Adapter::Test::Stubs.new)
         
     | 
| 
       38 
38 
     | 
    
         
             
                    end
         
     | 
| 
       39 
     | 
    
         
            -
                    pr_3 = Sawyer::Resource.new(agent,  
     | 
| 
       40 
     | 
    
         
            -
                    pr_4 = Sawyer::Resource.new(agent,  
     | 
| 
      
 39 
     | 
    
         
            +
                    pr_3 = Sawyer::Resource.new(agent, load_yaml("pr_3.yml"))
         
     | 
| 
      
 40 
     | 
    
         
            +
                    pr_4 = Sawyer::Resource.new(agent, load_yaml("pr_4.yml"))
         
     | 
| 
       41 
41 
     | 
    
         
             
                    [pr_3, pr_4]
         
     | 
| 
       42 
42 
     | 
    
         
             
                  }
         
     | 
| 
       43 
43 
     | 
    
         
             
                  it {
         
     | 
| 
         @@ -219,8 +219,8 @@ RSpec.describe Git::Pr::Release::CLI do 
     | 
|
| 
       219 
219 
     | 
    
         
             
                  }
         
     | 
| 
       220 
220 
     | 
    
         | 
| 
       221 
221 
     | 
    
         
             
                  client = double(Octokit::Client)
         
     | 
| 
       222 
     | 
    
         
            -
                  @pr_3 = Sawyer::Resource.new(agent,  
     | 
| 
       223 
     | 
    
         
            -
                  @pr_4 = Sawyer::Resource.new(agent,  
     | 
| 
      
 222 
     | 
    
         
            +
                  @pr_3 = Sawyer::Resource.new(agent, load_yaml("pr_3.yml"))
         
     | 
| 
      
 223 
     | 
    
         
            +
                  @pr_4 = Sawyer::Resource.new(agent, load_yaml("pr_4.yml"))
         
     | 
| 
       224 
224 
     | 
    
         
             
                  expect(client).to receive(:pull_request).with("motemen/git-pr-release", 3) { @pr_3 }
         
     | 
| 
       225 
225 
     | 
    
         
             
                  expect(client).to receive(:pull_request).with("motemen/git-pr-release", 4) { @pr_4 }
         
     | 
| 
       226 
226 
     | 
    
         
             
                  allow(@cli).to receive(:client).with(no_args) { client }
         
     | 
| 
         @@ -241,8 +241,8 @@ RSpec.describe Git::Pr::Release::CLI do 
     | 
|
| 
       241 
241 
     | 
    
         
             
                  end
         
     | 
| 
       242 
242 
     | 
    
         | 
| 
       243 
243 
     | 
    
         
             
                  @merged_prs = [
         
     | 
| 
       244 
     | 
    
         
            -
                    Sawyer::Resource.new(@agent,  
     | 
| 
       245 
     | 
    
         
            -
                    Sawyer::Resource.new(@agent,  
     | 
| 
      
 244 
     | 
    
         
            +
                    Sawyer::Resource.new(@agent, load_yaml("pr_3.yml")),
         
     | 
| 
      
 245 
     | 
    
         
            +
                    Sawyer::Resource.new(@agent, load_yaml("pr_4.yml")),
         
     | 
| 
       246 
246 
     | 
    
         
             
                  ]
         
     | 
| 
       247 
247 
     | 
    
         | 
| 
       248 
248 
     | 
    
         
             
                  allow(@cli).to receive(:detect_existing_release_pr) { existing_release_pr }
         
     | 
| 
         @@ -261,7 +261,7 @@ RSpec.describe Git::Pr::Release::CLI do 
     | 
|
| 
       261 
261 
     | 
    
         | 
| 
       262 
262 
     | 
    
         
             
                context "When create_mode" do
         
     | 
| 
       263 
263 
     | 
    
         
             
                  before {
         
     | 
| 
       264 
     | 
    
         
            -
                    @created_pr = Sawyer::Resource.new(@agent,  
     | 
| 
      
 264 
     | 
    
         
            +
                    @created_pr = Sawyer::Resource.new(@agent, load_yaml("pr_1.yml"))
         
     | 
| 
       265 
265 
     | 
    
         
             
                    allow(@cli).to receive(:prepare_release_pr) { @created_pr }
         
     | 
| 
       266 
266 
     | 
    
         
             
                  }
         
     | 
| 
       267 
267 
     | 
    
         | 
| 
         @@ -301,7 +301,7 @@ RSpec.describe Git::Pr::Release::CLI do 
     | 
|
| 
       301 
301 
     | 
    
         | 
| 
       302 
302 
     | 
    
         
             
                context "When dry_run with create_mode" do
         
     | 
| 
       303 
303 
     | 
    
         
             
                  before {
         
     | 
| 
       304 
     | 
    
         
            -
                    @created_pr = Sawyer::Resource.new(@agent,  
     | 
| 
      
 304 
     | 
    
         
            +
                    @created_pr = Sawyer::Resource.new(@agent, load_yaml("pr_1.yml"))
         
     | 
| 
       305 
305 
     | 
    
         
             
                    allow(@cli).to receive(:prepare_release_pr) { @created_pr }
         
     | 
| 
       306 
306 
     | 
    
         | 
| 
       307 
307 
     | 
    
         
             
                    @cli.instance_variable_set(:@dry_run, true)
         
     | 
    
        data/spec/git/pr/release_spec.rb
    CHANGED
    
    | 
         @@ -8,13 +8,13 @@ RSpec.describe Git::Pr::Release do 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  conn.builder.handlers.delete(Faraday::Adapter::NetHttp)
         
     | 
| 
       9 
9 
     | 
    
         
             
                  conn.adapter :test, @stubs
         
     | 
| 
       10 
10 
     | 
    
         
             
                end
         
     | 
| 
       11 
     | 
    
         
            -
                @release_pr = Sawyer::Resource.new(@agent,  
     | 
| 
      
 11 
     | 
    
         
            +
                @release_pr = Sawyer::Resource.new(@agent, load_yaml("pr_1.yml"))
         
     | 
| 
       12 
12 
     | 
    
         
             
                @merged_prs = [
         
     | 
| 
       13 
     | 
    
         
            -
                  Sawyer::Resource.new(@agent,  
     | 
| 
       14 
     | 
    
         
            -
                  Sawyer::Resource.new(@agent,  
     | 
| 
      
 13 
     | 
    
         
            +
                  Sawyer::Resource.new(@agent, load_yaml("pr_3.yml")),
         
     | 
| 
      
 14 
     | 
    
         
            +
                  Sawyer::Resource.new(@agent, load_yaml("pr_6.yml")),
         
     | 
| 
       15 
15 
     | 
    
         
             
                ]
         
     | 
| 
       16 
16 
     | 
    
         
             
                @changed_files = [
         
     | 
| 
       17 
     | 
    
         
            -
                  Sawyer::Resource.new(@agent,  
     | 
| 
      
 17 
     | 
    
         
            +
                  Sawyer::Resource.new(@agent, load_yaml("pr_1_files.yml")),
         
     | 
| 
       18 
18 
     | 
    
         
             
                ]
         
     | 
| 
       19 
19 
     | 
    
         
             
              end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
         @@ -24,8 +24,8 @@ RSpec.describe Git::Pr::Release do 
     | 
|
| 
       24 
24 
     | 
    
         
             
                    pr_title, new_body = build_pr_title_and_body(@release_pr, @merged_prs, @changed_files, nil)
         
     | 
| 
       25 
25 
     | 
    
         
             
                    expect(pr_title).to eq "Release 2019-02-20 22:58:35 +0900"
         
     | 
| 
       26 
26 
     | 
    
         
             
                    expect(new_body).to eq <<~MARKDOWN
         
     | 
| 
       27 
     | 
    
         
            -
                      - [ ] #3  
     | 
| 
       28 
     | 
    
         
            -
                      - [ ] #6  
     | 
| 
      
 27 
     | 
    
         
            +
                      - [ ] #3 @hakobe
         
     | 
| 
      
 28 
     | 
    
         
            +
                      - [ ] #6 @ninjinkun
         
     | 
| 
       29 
29 
     | 
    
         
             
                    MARKDOWN
         
     | 
| 
       30 
30 
     | 
    
         
             
                  }
         
     | 
| 
       31 
31 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,4 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module FileFixtureSupport
         
     | 
| 
      
 2 
     | 
    
         
            +
              def load_yaml(fixture_name)
         
     | 
| 
      
 3 
     | 
    
         
            +
                if YAML.respond_to?(:unsafe_load_file)
         
     | 
| 
      
 4 
     | 
    
         
            +
                  YAML.unsafe_load_file(file_fixture(fixture_name))
         
     | 
| 
      
 5 
     | 
    
         
            +
                else
         
     | 
| 
      
 6 
     | 
    
         
            +
                  YAML.load_file(file_fixture(fixture_name))
         
     | 
| 
      
 7 
     | 
    
         
            +
                end
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
       2 
10 
     | 
    
         
             
              def file_fixture(fixture_name)
         
     | 
| 
       3 
11 
     | 
    
         
             
                file_fixture_path = RSpec.configuration.file_fixture_path
         
     | 
| 
       4 
12 
     | 
    
         
             
                path = Pathname.new(File.join(file_fixture_path, fixture_name))
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: git-pr-release
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.1.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - motemen
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-03-08 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: octokit
         
     | 
| 
         @@ -117,6 +117,7 @@ executables: 
     | 
|
| 
       117 
117 
     | 
    
         
             
            extensions: []
         
     | 
| 
       118 
118 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       119 
119 
     | 
    
         
             
            files:
         
     | 
| 
      
 120 
     | 
    
         
            +
            - ".github/workflows/test.yml"
         
     | 
| 
       120 
121 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       121 
122 
     | 
    
         
             
            - ".rspec"
         
     | 
| 
       122 
123 
     | 
    
         
             
            - CHANGELOG.md
         
     | 
| 
         @@ -162,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       162 
163 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       163 
164 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       164 
165 
     | 
    
         
             
            requirements: []
         
     | 
| 
       165 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 166 
     | 
    
         
            +
            rubygems_version: 3.4.0.dev
         
     | 
| 
       166 
167 
     | 
    
         
             
            signing_key:
         
     | 
| 
       167 
168 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       168 
169 
     | 
    
         
             
            summary: Creates a release pull request
         
     |