class Bard::CI::GithubActions::API
Public Instance Methods
Source
# File lib/bard/ci/github_actions.rb, line 69 def create_run! branch start_time = Time.now client.post("actions/workflows/ci.yml/dispatches", ref: branch, inputs: { "git-ref": branch }) sha = `git rev-parse #{branch}`.chomp loop do runs = client.get("actions/runs", head_sha: sha, created: ">#{start_time.iso8601}") if json = runs["workflow_runs"].first return Run.new(self, json) end sleep 1 end end
Source
# File lib/bard/ci/github_actions.rb, line 89 def download_logs_by_job_id job_id client.get("actions/jobs/#{job_id}/logs") end
Source
# File lib/bard/ci/github_actions.rb, line 83 def find_job_by_run_id run_id jobs = client.get("actions/runs/#{run_id}/jobs", filter: "latest", per_page: 1) job_json = jobs["jobs"][0] Job.new(self, job_json) end
Source
# File lib/bard/ci/github_actions.rb, line 64 def find_run id json = client.get("actions/runs/#{id}") Run.new(self, json) end
Source
# File lib/bard/ci/github_actions.rb, line 50 def last_run response = client.get("actions/runs", event: "workflow_dispatch", per_page: 1) if json = response["workflow_runs"][0] Run.new(self, json) end end
Source
# File lib/bard/ci/github_actions.rb, line 57 def last_successful_run successful_runs = client.get("actions/runs", event: "workflow_dispatch", status: "success", per_page: 1) if json = successful_runs["workflow_runs"][0] Run.new(self, json) end end
Private Instance Methods
Source
# File lib/bard/ci/github_actions.rb, line 95 def client @client ||= Bard::Github.new(project_name) end