Class: Groundskeeper::Github
- Inherits:
-
Object
- Object
- Groundskeeper::Github
- Defined in:
- lib/groundskeeper/github.rb
Overview
Github API wrapper
Constant Summary collapse
- COMMAND =
"gh api"- GITHUB_ORG =
"NU-RADD"- HOSTNAME =
"github.com"- CREATE_PR =
"--method POST\n-H \"Accept: application/vnd.github+json\"\n-H \"X-GitHub-Api-Version: 2022-11-28\"\n--hostname \#{HOSTNAME}\n/repos/\#{GITHUB_ORG}/%<repository>s/pulls\n-f 'title=%<branch_name>s' -f 'head=%<branch_name>s' -f 'base=main'\n".split.join(" ")
Instance Attribute Summary collapse
-
#github ⇒ Object
readonly
Returns the value of attribute github.
Class Method Summary collapse
-
.build ⇒ Object
:nocov:.
Instance Method Summary collapse
- #create_pr(repository:, branch_name:) ⇒ Object
-
#credentials? ⇒ Boolean
:nocov:.
-
#initialize(github) ⇒ Github
constructor
:nocov:.
Constructor Details
#initialize(github) ⇒ Github
:nocov:
28 29 30 |
# File 'lib/groundskeeper/github.rb', line 28 def initialize(github) @github = github end |
Instance Attribute Details
#github ⇒ Object (readonly)
Returns the value of attribute github.
20 21 22 |
# File 'lib/groundskeeper/github.rb', line 20 def github @github end |
Class Method Details
.build ⇒ Object
:nocov:
23 24 25 |
# File 'lib/groundskeeper/github.rb', line 23 def self.build new Executable.new(COMMAND) end |
Instance Method Details
#create_pr(repository:, branch_name:) ⇒ Object
32 33 34 |
# File 'lib/groundskeeper/github.rb', line 32 def create_pr(repository:, branch_name:) github.execute(format(CREATE_PR, repository: repository, branch_name: branch_name)) end |
#credentials? ⇒ Boolean
:nocov:
37 38 39 |
# File 'lib/groundskeeper/github.rb', line 37 def credentials? true end |