tutter-sppuppet 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjMzYTk0ZTRlYjM1YjRiOTkwNDA3NzBlZDUwYmVhNDliOWVlOGZhYQ==
4
+ ZTYzMjJkNzU3NzBlOTgwYzhlZTgyMTcxODc4NmRiMTAyZjc3MjliYg==
5
5
  data.tar.gz: !binary |-
6
- MmY1YmQ4OTcxZmQ3ZWJmYWMyZDAwZjllNTE5ODA3MDkzODU1Y2FhYw==
6
+ MGU2YjJkMzkyYWYyNTRmZjAyYjViYmI1Y2Y4ZTE0YzE0NjFhYjdkNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YmY5NjBlZWNkYzVhNmExYWEyM2I0NzZhMGNkZGU4ZmVlZjBiZGVlN2I5ZGU2
10
- OTAwN2ExYTZjNDc3N2VhMTk0ZGMzZjk4YjQ1ZGM3MTFkNWQ5YjlmODQyNGM3
11
- YmI4ZGNkMzc4MzM2MDAyMmQxNmZlZDRjMzI1Njk4YWMyMTNkYzg=
9
+ ODkwNmU2OTRiMzc5YTEwMzI4ZmNkZmJiNjRiYWM1MTc1Y2QxZDBjOTZkZDQy
10
+ MjEyMTllMWMxZjIzOTlmOWYyYWE4NWYxNDlkOGE2ZWUyZWY4Y2FlOTNhNjdl
11
+ YzhkNjg1OGVmY2Y5MDAxMzg0OTdjNjcwY2YxZWZkZTFlMzAyMWQ=
12
12
  data.tar.gz: !binary |-
13
- ODI4MzdiMjYwNzEyNWVjMDkzOWZhZmJlZDdmMjJjM2YyZTRlNzNhYWViNDkx
14
- ZjFiYmU3ZjAwNWE3NDY4YmQ2MmY0MzlmOTQ5MmVlZWMwNDhiYTAxZGYwNmFh
15
- NzI2NDllNDQwYjcxMmNmZWI0NDQ1NjlmYzRiZjI0YWM0ZjMzZjM=
13
+ NWNhOTFmNzEzNDZkZDhhZDRjZWFjZDE5ZDEyZmJlNzUxMzA2OTE5OGZjZDMz
14
+ ODRjZDdkYzdmZjc2Nzg1NjQzM2Q4NjAxNTNmNTg3NDQ3Y2RjMjVhYTBlM2Fh
15
+ NGQxZTAyMGUyYjI0YjE2M2VmZjhkYjEyYjA0NmM0MzA0NGYxYjE=
data/README.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # tutter-sppuppet
2
2
 
3
- This action let non collaborators review
4
- and merge code without having more then read access to the project.
3
+ This action lets non-collaborators review and merge code without having push access to the project.
4
+
5
+ Here's how it works:
5
6
 
6
7
  1. A pull request get submitted
7
- 2. Someone thinks it looks good and adds a _+1_ comment
8
- 3. Another person comment _+1_
8
+ 2. Someone reviews it and adds a _+1_ comment
9
+ 3. Another person comments _+1_
9
10
  4. The pull request can be merged by commenting _!merge_ when it has the
10
11
  desired amount of +1's(configurable, defaults to 1)
11
12
 
@@ -22,6 +23,8 @@ sppuppet specific settings (goes into tutter.yaml)
22
23
  plus_ones_required: 3
23
24
  post_instructions: true
24
25
  instructions: 'To merge, post 3 +1s and then !merge'
26
+ generate_reports = true
27
+ reports_dir = '/var/lib/tutter/reports'
25
28
 
26
29
  ### TODO
27
30
  * whitelist
@@ -1,8 +1,12 @@
1
+ require 'fileutils'
2
+ require 'json'
3
+
1
4
  class Sppuppet
2
5
 
3
6
  def initialize(settings, client, project, data, event)
4
7
  @settings = settings
5
8
  @settings['plus_ones_required'] ||= 1
9
+ @settings['reports_dir'] ||= '/var/lib/tutter/reports'
6
10
  @client = client
7
11
  @project = project
8
12
  @data = data
@@ -80,8 +84,22 @@ class Sppuppet
80
84
 
81
85
  merge = comments.last.body == '!merge' || comments.last.body == ':shipit:'
82
86
 
83
- if plus_one.count >= @settings['plus_ones_required'] and merge
84
- @client.merge_pull_request(@project, pull_request_id, 'SHIPPING!!')
87
+ if plus_one.count >= @settings['plus_ones_required'] && merge
88
+ merge_commit = @client.merge_pull_request(@project, pull_request_id, 'SHIPPING!!')
89
+ json = { url: pr.html_url,
90
+ title: pr.title,
91
+ author: pr.user.login,
92
+ merge_sha: merge_commit.sha,
93
+ head_sha: pr.head.sha,
94
+ tests: @client.combined_status(@project, pr.head.sha).statuses.map { |s| {state: s.state, url: s.target_url, description: s.description } },
95
+ reviewers: plus_one.keys,
96
+ deployer: comments.last.user.login }
97
+ report_directory = "#{@settings['reports_dir']}/#{merge_commit.sha[0..1]}/#{merge_commit.sha[2..3]}"
98
+ report_path = "#{report_directory}/#{merge_commit.sha}.json"
99
+ if @settings['generate_reports']
100
+ FileUtils.mkdir_p report_directory
101
+ File.open(report_path, 'w') { |f| f.write(JSON.pretty_generate(json)) }
102
+ end
85
103
  return 200, "merging #{pull_request_id} #{@project}"
86
104
  elsif plus_one.count >= @settings['plus_ones_required']
87
105
  return 200, "have enough +1, but no merge command"
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'tutter-sppuppet'
4
- s.version = '0.0.8'
5
- s.author = 'Johan Haals'
6
- s.email = ['johan.haals@gmail.com']
4
+ s.version = '0.0.9'
5
+ s.author = ['Johan Haals', 'Erik Dalén', 'Alexey Lapitsky']
6
+ s.email = ['johan.haals@gmail.com', 'dalen@spotify.com', 'alexey@spotify.com']
7
7
  s.homepage = 'https://github.com/jhaals/tutter-sppuppet'
8
8
  s.summary = 'Github code review without collaborator access'
9
9
  s.description = 'This tutter action let non collaborators review and merge code without having more then read access to the project'
metadata CHANGED
@@ -1,14 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tutter-sppuppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan Haals
8
+ - Erik Dalén
9
+ - Alexey Lapitsky
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2015-02-02 00:00:00.000000000 Z
13
+ date: 2015-02-17 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
16
  name: tutter
@@ -28,6 +30,8 @@ description: This tutter action let non collaborators review and merge code with
28
30
  having more then read access to the project
29
31
  email:
30
32
  - johan.haals@gmail.com
33
+ - dalen@spotify.com
34
+ - alexey@spotify.com
31
35
  executables: []
32
36
  extensions: []
33
37
  extra_rdoc_files: []