firespring_dev_commands 3.0.0 → 3.0.1.pre.alpha.0
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: 0d73057c14d0636888e6b17cf36ccb5218289e6bfa80f3eb5834f82ec2140280
|
4
|
+
data.tar.gz: bef017e5cb1fc0195c842bbb7ccdd3abc11fef66e6d488566de6171c3b5886eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2dfa1b72f79fa7a20293702ad63eb180f5254c4bdedc897e010c47f2658efe274ad17776d5ec9ad0a04c9bdbe9fe3653e2243f5d9e1c21853ff73866205ee1e
|
7
|
+
data.tar.gz: 908753aab7984c7e4648ad124bdfc9f21b63a69df824507a23cab6cb86a1c4ad5e13324ac3ccb12ce5747a92322d7ebdb2e0d4d92f1879c3c9267d090ba2e630
|
@@ -424,6 +424,22 @@ module Dev
|
|
424
424
|
g.fetch('origin', prune: true)
|
425
425
|
end
|
426
426
|
|
427
|
+
def commit_status(repository:, branch:, status:, organization: 'firespring', options: {})
|
428
|
+
token = ENV['GITHUB_TOKEN'].to_s.strip
|
429
|
+
raise 'GITHUB_TOKEN is required' unless token
|
430
|
+
|
431
|
+
# Set up the GitHub client
|
432
|
+
client = Octokit::Client.new(access_token: token)
|
433
|
+
|
434
|
+
# Fetch the latest commit SHA for the given branch
|
435
|
+
repo = "#{organization}/#{repository}"
|
436
|
+
ref = "heads/#{branch}"
|
437
|
+
sha = client.ref(repo, ref).object.sha
|
438
|
+
|
439
|
+
# Create the commit status
|
440
|
+
client.create_status(repo, sha, status, options)
|
441
|
+
end
|
442
|
+
|
427
443
|
# Builds an ssh repo URL using the org and repo name given
|
428
444
|
def ssh_repo_url(name, org)
|
429
445
|
"git@github.com:#{org}/#{name}.git"
|
@@ -159,6 +159,49 @@ module Dev
|
|
159
159
|
end
|
160
160
|
end
|
161
161
|
end
|
162
|
+
|
163
|
+
# Create the rake task for the git commit status task.
|
164
|
+
def create_commit_status_task!
|
165
|
+
# Have to set a local variable to be accessible inside of the instance_eval block
|
166
|
+
exclude = @exclude
|
167
|
+
|
168
|
+
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
169
|
+
namespace :git do
|
170
|
+
return if exclude.include?(:commit_status)
|
171
|
+
|
172
|
+
# TODO: Clean, comments and description
|
173
|
+
desc 'Add status to commit' \
|
174
|
+
"\n\tuse TODO"
|
175
|
+
|
176
|
+
task :create_commit_status do
|
177
|
+
# Key Values
|
178
|
+
repository = ENV['REPOSITORY'].to_s.strip
|
179
|
+
branch = ENV['BRANCH'].to_s.strip
|
180
|
+
status = ENV['STATUS'].to_s.strip
|
181
|
+
|
182
|
+
raise 'Repository name is required' unless repository
|
183
|
+
raise 'Branch name is required' unless branch
|
184
|
+
raise 'Status is required' unless status
|
185
|
+
|
186
|
+
# Validate status
|
187
|
+
valid_statuses = %w(error failure pending success)
|
188
|
+
raise "Invalid status: #{status}. Valid statuses are: #{valid_statuses.join(', ')}" unless valid_statuses.include?(status)
|
189
|
+
|
190
|
+
# Optional Values
|
191
|
+
context = ENV['CONTEXT'].to_s.strip
|
192
|
+
description = ENV['DESCRIPTION'].to_s.strip
|
193
|
+
target_url = ENV['TARGET_URL'].to_s.strip
|
194
|
+
|
195
|
+
options = {}
|
196
|
+
options[:context] = context unless context.empty?
|
197
|
+
options[:description] = description unless description.empty?
|
198
|
+
options[:target_url] = target_url unless target_url.empty?
|
199
|
+
|
200
|
+
Dev::Git.new.commit_status(repository:, branch:, status:, options:)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
162
205
|
end
|
163
206
|
end
|
164
207
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firespring_dev_commands
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0
|
4
|
+
version: 3.0.1.pre.alpha.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Firespring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -262,6 +262,20 @@ dependencies:
|
|
262
262
|
- - "~>"
|
263
263
|
- !ruby/object:Gem::Version
|
264
264
|
version: 2.3.0
|
265
|
+
- !ruby/object:Gem::Dependency
|
266
|
+
name: octokit
|
267
|
+
requirement: !ruby/object:Gem::Requirement
|
268
|
+
requirements:
|
269
|
+
- - "~>"
|
270
|
+
- !ruby/object:Gem::Version
|
271
|
+
version: '8.1'
|
272
|
+
type: :runtime
|
273
|
+
prerelease: false
|
274
|
+
version_requirements: !ruby/object:Gem::Requirement
|
275
|
+
requirements:
|
276
|
+
- - "~>"
|
277
|
+
- !ruby/object:Gem::Version
|
278
|
+
version: '8.1'
|
265
279
|
- !ruby/object:Gem::Dependency
|
266
280
|
name: ox
|
267
281
|
requirement: !ruby/object:Gem::Requirement
|
@@ -430,9 +444,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
430
444
|
version: '3.1'
|
431
445
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
432
446
|
requirements:
|
433
|
-
- - "
|
447
|
+
- - ">"
|
434
448
|
- !ruby/object:Gem::Version
|
435
|
-
version:
|
449
|
+
version: 1.3.1
|
436
450
|
requirements: []
|
437
451
|
rubygems_version: 3.4.10
|
438
452
|
signing_key:
|