octokitted 0.0.7 → 0.0.9

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/octokitted.rb +10 -3
  3. data/lib/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 930bcddc8ee154391c8deb09e7a2c0e483e49d6cb3091adeb70239d0388d3e5d
4
- data.tar.gz: b64e1ba7b33e4c2eeb73975825bf5fa7cd2eaf37f63383b01427e4adddbd7e4a
3
+ metadata.gz: 6eb37191994ca5fbce98292fa7d110d1b8ba0cef9adbfdcee64ff9a4c86783c5
4
+ data.tar.gz: dddf0023f475c442215e2c73c0112782cbef093c4725d321e72d3bcff9edffaf
5
5
  SHA512:
6
- metadata.gz: c2738d3e5a2bb9bb665a8ed84f76ecbe4594b753e46b27a49d504587fbceae86f4a5905bd704368373bf4868551fe5a014716555e274f22fcad95b8d29eb107c
7
- data.tar.gz: 486cf3f74dc41658968876d79d11383c1d8bfe7577f822c4fe17660555e96f4fa5480f180acd86bd140cbd8af7c972ad4068bb74436a8d2127238ba56141afb9
6
+ metadata.gz: 256b887a612783254b34ccabb3f4e8c348df57656f1562507453802bf37252214157164f79d45032ef8231e05ccc46b8b25f4a82e8f9850b17eff5ff5e7249c8
7
+ data.tar.gz: dc678d7dd0658e9ea8e0d8983b99f17784836140140b31e303b5718b7c39d465706db56061a9d26e79d48ea609b83599c6b2b61eed5330309f07a389ad0ce55d
data/lib/octokitted.rb CHANGED
@@ -40,7 +40,7 @@ class Octokitted
40
40
  @cloned_repos = []
41
41
  @event_path = event_path || ENV.fetch("GITHUB_EVENT_PATH", nil)
42
42
  @sha = ENV.fetch("GITHUB_SHA", nil)
43
- org_and_repo_hash = fetch_org_and_repo
43
+ org_and_repo_hash = fetch_org_and_repo(org, repo)
44
44
  @login = login
45
45
  @org = org || org_and_repo_hash[:org]
46
46
  @repo = repo || org_and_repo_hash[:repo]
@@ -137,8 +137,11 @@ class Octokitted
137
137
 
138
138
  # Fetch the org and repo from the environment
139
139
  # :return: A hash containing the org and repo, and the org and repo separately
140
- Contract None => HashOf[Symbol, String]
141
- def fetch_org_and_repo
140
+ Contract Maybe[String], Maybe[String] => Hash
141
+ def fetch_org_and_repo(org, repo)
142
+ # if org and repo are provided, and not nil, use them
143
+ return { org_and_repo: "#{org}/#{repo}", org:, repo: } if org && repo
144
+
142
145
  org_and_repo = ENV.fetch("GITHUB_REPOSITORY", nil)
143
146
  org = nil
144
147
  repo = nil
@@ -156,6 +159,10 @@ class Octokitted
156
159
  # :return: A Hash of the GitHub event data or nil if not found
157
160
  Contract Maybe[String] => Maybe[Hash]
158
161
  def fetch_github_event(event_path)
162
+ if ENV.fetch("GITHUB_ACTIONS", nil).nil?
163
+ @log.debug("Not running in GitHub Actions - GitHub Event data not auto-hydrated")
164
+ return nil
165
+ end
159
166
  unless event_path
160
167
  @log.warn("GITHUB_EVENT_PATH env var not found")
161
168
  return nil
data/lib/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Octokitted
4
4
  module Version
5
- VERSION = "0.0.7"
5
+ VERSION = "0.0.9"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octokitted
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Birkinbine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-16 00:00:00.000000000 Z
11
+ date: 2023-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: contracts