Skip to content

Commit

Permalink
add a call to octokit into the cli to just ensure vendored deps alway…
Browse files Browse the repository at this point in the history
…s work
  • Loading branch information
GrantBirki committed Sep 24, 2024
1 parent cf5c173 commit 7649d95
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/cli.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "octokit"
require "log"
require "./lib/crystal-base-template"
require "./lib/github-version-check"

module CLI
def self.main
Expand All @@ -16,6 +16,9 @@ module CLI

Log.info { "attempting to crunch the numbers" }
result = Crystal::Base::Template.add(num1, num2)

github_version_check

puts result
end
end
Expand Down
18 changes: 10 additions & 8 deletions src/lib/github-version-check.cr
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
require "octokit"
require "json"

# auth via octokit.cr
github = Octokit.client
def github_version_check
# auth via octokit.cr
github = Octokit.client

# fetch info about the crystal-base-template repo
repo_data = github.get("/repos/GrantBirki/crystal-base-template/commits/main")
# fetch info about the crystal-base-template repo
repo_data = github.get("/repos/GrantBirki/crystal-base-template/commits/main")

# convert the json string to a hash
repo_data = JSON.parse(repo_data)
# convert the json string to a hash
repo_data = JSON.parse(repo_data)

# print the latest sha of this template repo
puts "current sha of crystal-base-template: #{repo_data["sha"]}"
# print the latest sha of this template repo
puts "current sha of crystal-base-template: #{repo_data["sha"]}"
end

0 comments on commit 7649d95

Please sign in to comment.