cucumber-ci-environment 9.0.0 → 9.0.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddb3770efbf64c848ff0784bc16b46bd1aac7310bb3543af9354eefaf934d590
|
4
|
+
data.tar.gz: 963b15c15a33c7b706b43bc3d7e83ca96b4dbe6d8562b3afc3a8909fceb0d4e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a6a3f4a3091dba40f37fe3f4831e9eaab18230750536770c891d657d14886ce651e440b136f9a731b2e20f7fb6d0878c92ce8fa6e98ccc2f2569e6e9b88e3b9
|
7
|
+
data.tar.gz: dafdfbf95a1e2a2283844256ddcbabde2c32edd8923c80e515d966e7e8f330f9e0e3a2ee9ef9ccd81cfc433fbc38dfd9c85653b78903dd09fca60238e6080863
|
@@ -33,7 +33,7 @@ module Cucumber
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def detect_git(ci_environment, env)
|
36
|
-
revision =
|
36
|
+
revision = detect_revision(ci_environment, env)
|
37
37
|
return nil if revision.nil?
|
38
38
|
|
39
39
|
remote = evaluate(ci_environment['git']['remote'], env)
|
@@ -51,6 +51,18 @@ module Cucumber
|
|
51
51
|
git_info
|
52
52
|
end
|
53
53
|
|
54
|
+
def detect_revision(ci_environment, env)
|
55
|
+
if env['GITHUB_EVENT_NAME'] == 'pull_request'
|
56
|
+
raise StandardError('GITHUB_EVENT_PATH not set') unless env['GITHUB_EVENT_PATH']
|
57
|
+
event = JSON.parse(IO.read(env['GITHUB_EVENT_PATH']))
|
58
|
+
revision = event['pull_request']['head']['sha'] rescue nil
|
59
|
+
raise StandardError("Could not find .pull_request.head.sha in #{env['GITHUB_EVENT_PATH']}:\n#{JSON.pretty_generate(event)}") if revision.nil?
|
60
|
+
return revision
|
61
|
+
end
|
62
|
+
|
63
|
+
return evaluate(ci_environment['git']['revision'], env)
|
64
|
+
end
|
65
|
+
|
54
66
|
def remove_userinfo_from_url(value)
|
55
67
|
return nil if value.nil?
|
56
68
|
|
@@ -63,6 +75,6 @@ module Cucumber
|
|
63
75
|
end
|
64
76
|
end
|
65
77
|
|
66
|
-
module_function :detect_ci_environment, :detect, :detect_git, :remove_userinfo_from_url
|
78
|
+
module_function :detect_ci_environment, :detect, :detect_git, :detect_revision, :remove_userinfo_from_url
|
67
79
|
end
|
68
80
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
describe 'GitHub' do
|
2
|
+
if (ENV['GITHUB_EVENT_NAME'] == 'pull_request')
|
3
|
+
it 'detects the correct revision for pull requests' do
|
4
|
+
ci_environment = Cucumber::CiEnvironment.detect_ci_environment(ENV)
|
5
|
+
expect(ci_environment).to be_truthy
|
6
|
+
puts ("Manually verify that the revision is correct");
|
7
|
+
p ci_environment
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-ci-environment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.0.
|
4
|
+
version: 9.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Prêtre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -36,20 +36,20 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '3.
|
39
|
+
version: '3.11'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 3.
|
42
|
+
version: 3.11.0
|
43
43
|
type: :development
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '3.
|
49
|
+
version: '3.11'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 3.
|
52
|
+
version: 3.11.0
|
53
53
|
description: Detect CI Environment from environment variables
|
54
54
|
email: cukes@googlegroups.com
|
55
55
|
executables: []
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- spec/capture_warnings.rb
|
64
64
|
- spec/cucumber/ci_environment/ci_environment_spec.rb
|
65
65
|
- spec/cucumber/ci_environment/evaluate_variable_expression_spec.rb
|
66
|
+
- spec/cucumber/ci_environment/github_pull_request_integration_spec.rb
|
66
67
|
- spec/cucumber/ci_environment/remove_userinfo_from_url_spec.rb
|
67
68
|
homepage: https://github.com/cucumber/ci-environment
|
68
69
|
licenses:
|
@@ -92,9 +93,10 @@ requirements: []
|
|
92
93
|
rubygems_version: 3.2.32
|
93
94
|
signing_key:
|
94
95
|
specification_version: 4
|
95
|
-
summary: cucumber-ci-environment-9.0.
|
96
|
+
summary: cucumber-ci-environment-9.0.3
|
96
97
|
test_files:
|
97
98
|
- spec/capture_warnings.rb
|
98
99
|
- spec/cucumber/ci_environment/ci_environment_spec.rb
|
99
100
|
- spec/cucumber/ci_environment/evaluate_variable_expression_spec.rb
|
101
|
+
- spec/cucumber/ci_environment/github_pull_request_integration_spec.rb
|
100
102
|
- spec/cucumber/ci_environment/remove_userinfo_from_url_spec.rb
|