escobar 0.1.25 → 0.1.26
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/lib/escobar/github/client.rb +25 -2
- data/lib/escobar/heroku/pipeline.rb +3 -3
- data/lib/escobar/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27a470255b00c4fcdbab4f72c00b0ad756240ae6
|
4
|
+
data.tar.gz: 30f72aea16837ba7e86e96a67895db5fcf632307
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c78de4e0a6286598f8ba10661b4f11816b27d9a8c6245c800b5646abc8b4fa4fce215b9a6dbd29cc98fcecc688031563de6b73f639c168fb7d85abf30dab47b
|
7
|
+
data.tar.gz: 7d6d8127c085ad61d01ee9686ee0a6af77f0c7fe1e73cad00867df3e14a49c8d0ca7161991161fe061328d7f56a7cbf7a1c3bcba2fd20b37b6efd997fbbc53bf
|
@@ -25,6 +25,25 @@ module Escobar
|
|
25
25
|
response && response.headers && response.headers["Location"]
|
26
26
|
end
|
27
27
|
|
28
|
+
def required_contexts
|
29
|
+
path = "/repos/#{name_with_owner}/branches/#{default_branch}"
|
30
|
+
repo = JSON.parse(http_method(:get, path).body)
|
31
|
+
if repo["protection"] && repo["protection"]["enabled"]
|
32
|
+
return repo["protection"]["required_status_checks"]["contexts"]
|
33
|
+
else
|
34
|
+
[]
|
35
|
+
end
|
36
|
+
rescue StandardError
|
37
|
+
[]
|
38
|
+
end
|
39
|
+
|
40
|
+
def default_branch
|
41
|
+
response = http_method(:get, "/repos/#{name_with_owner}")
|
42
|
+
JSON.parse(response.body)["default_branch"]
|
43
|
+
rescue StandardError
|
44
|
+
"master"
|
45
|
+
end
|
46
|
+
|
28
47
|
def create_deployment(options)
|
29
48
|
body = {
|
30
49
|
ref: options[:ref] || "master",
|
@@ -54,10 +73,14 @@ module Escobar
|
|
54
73
|
response && response.body
|
55
74
|
end
|
56
75
|
|
76
|
+
def accept_headers
|
77
|
+
"application/vnd.github.loki-preview+json"
|
78
|
+
end
|
79
|
+
|
57
80
|
def http_method(verb, path)
|
58
81
|
client.send(verb) do |request|
|
59
82
|
request.url path
|
60
|
-
request.headers["Accept"] =
|
83
|
+
request.headers["Accept"] = accept_headers
|
61
84
|
request.headers["Content-Type"] = "application/json"
|
62
85
|
request.headers["Authorization"] = "token #{token}"
|
63
86
|
end
|
@@ -66,7 +89,7 @@ module Escobar
|
|
66
89
|
def post(path, body)
|
67
90
|
response = client.post do |request|
|
68
91
|
request.url path
|
69
|
-
request.headers["Accept"] =
|
92
|
+
request.headers["Accept"] = accept_headers
|
70
93
|
request.headers["Content-Type"] = "application/json"
|
71
94
|
request.headers["Authorization"] = "token #{token}"
|
72
95
|
request.body = body.to_json
|
@@ -134,10 +134,10 @@ module Escobar
|
|
134
134
|
options = {
|
135
135
|
ref: ref,
|
136
136
|
task: task,
|
137
|
-
environment: environment,
|
138
|
-
required_contexts: [],
|
139
137
|
auto_merge: !force,
|
140
|
-
payload: extras.merge(custom_deployment_payload)
|
138
|
+
payload: extras.merge(custom_deployment_payload),
|
139
|
+
environment: environment,
|
140
|
+
required_contexts: github_client.required_contexts
|
141
141
|
}
|
142
142
|
github_client.create_deployment(options)
|
143
143
|
end
|
data/lib/escobar/version.rb
CHANGED