Class: GithubIssueCreation

Inherits:
Neetob::CLI::Github::Base show all
Defined in:
lib/neetob/cli/monthly_audit/github_issue_creation.rb

Constant Summary

Constants inherited from Neetob::CLI::Base

Neetob::CLI::Base::NEETO_APPS_LIST_LINK

Instance Attribute Summary

Attributes inherited from Neetob::CLI::Github::Base

#access_token, #client

Attributes inherited from Neetob::CLI::Base

#ui

Instance Method Summary collapse

Methods included from Utils

#camel_case_to_slug, #is_upper?, #symbolize_keys

Constructor Details

#initializeGithubIssueCreation

Returns a new instance of GithubIssueCreation.



6
7
8
9
# File 'lib/neetob/cli/monthly_audit/github_issue_creation.rb', line 6

def initialize
  super()
  @helpers = Neetob::CLI::Github::Issues::Helpers.new
end

Instance Method Details

#create_issue(repo:, title:, description:, labels: "") ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/neetob/cli/monthly_audit/github_issue_creation.rb', line 11

def create_issue(repo:, title:, description:, labels: "")
  return if Thread.current[:skip_issue]

  month = Thread.current[:month].capitalize.gsub("-", " ")
  title = "#{month} Audit - #{title}"

  # Checking if the issue already exists
  issue = @helpers.get_issue_with_title("bigbinary/#{repo}", title)
  if issue
    return issue.html_url
  end

  begin
    issue = client.create_issue(
      "bigbinary/#{repo}",
      title,
      "## #{title} \n #{description}",
      { labels: }
    )
    issue.html_url
  rescue StandardError => e
    ExceptionHandler.new(e).process
  end
end