Sha256: 8081824f4b9d99d53618c4713f6654120f36bd514a09b297c68aa08bcc2ecb8a
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
module Jets::Git class Github def params params = { git_system: 'github', git_branch: git_branch, git_sha: git_sha, git_dirty: false, # git_message: nil, # git_version: nil, } params[:git_url] = git_url if git_url params end def git_branch if build_type == "pull_request" pr.dig('pull_request','head','ref') else # push ENV['GITHUB_REF_NAME'] end end def git_sha if build_type == "pull_request" pr.dig('pull_request','head','sha') else # push ENV['GITHUB_SHA'] end end def git_url host = ENV['GITHUB_SERVER_URL'] || 'https://github.com' full_repo = ENV['GITHUB_REPOSITORY'] "#{host}/#{full_repo}" end # GitHub webhook JSON payload in file and path is set in GITHUB_EVENT_PATH def pr return {} unless ENV['GITHUB_EVENT_PATH'] JSON.load(IO.read(ENV['GITHUB_EVENT_PATH'])) end def build_type ENV['GITHUB_EVENT_NAME'] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jets-git-0.2.1 | lib/jets/git/github.rb |
jets-git-0.2.0 | lib/jets/git/github.rb |