Skip to content

Commit

Permalink
[ontoportal-bot] Gemfile.lock update
Browse files Browse the repository at this point in the history
  • Loading branch information
ontoportal-bot-lirmm authored and syphax-bouazzouni committed Sep 12, 2023
1 parent 224660b commit 18acf08
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
7 changes: 5 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ GEM
erubis (2.7.0)
eventmachine (1.2.7)
excon (0.102.0)
execjs (2.8.1)
execjs (2.9.0)
faraday (2.0.1)
faraday-net_http (~> 2.0)
ruby2_keywords (>= 0.0.4)
Expand Down Expand Up @@ -238,6 +238,8 @@ GEM
netrc (0.11.0)
newrelic_rpm (9.4.2)
nio4r (2.5.9)
nokogiri (1.15.4-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.15.4-x86_64-linux)
racc (~> 1.4)
oj (3.16.1)
Expand Down Expand Up @@ -328,7 +330,7 @@ GEM
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.12.1)
rubocop (1.56.2)
rubocop (1.56.3)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
Expand Down Expand Up @@ -426,6 +428,7 @@ GEM
zeitwerk (2.6.11)

PLATFORMS
x86_64-darwin-21
x86_64-linux

DEPENDENCIES
Expand Down
25 changes: 13 additions & 12 deletions app/services/issue_creator_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@
class IssueCreatorService < ApplicationService
class QueryError < StandardError; end

FindRepoQuery = GitHub::Client.parse <<-'GRAPHQL'

def initialize(params)
@title = params[:content][:title]
@body = params[:content][:body]
@repo = Rails.configuration.change_request.dig(:ontologies, params[:ont_acronym].to_sym, :repository)
end

def call

findRepoQuery = GitHub::Client.parse <<-'GRAPHQL'
query ($owner: String!, $name: String!) {
repository(owner: $owner, name: $name) {
id
}
}
GRAPHQL

CreateIssueMutation = GitHub::Client.parse <<-'GRAPHQL'
createIssueMutation = GitHub::Client.parse <<-'GRAPHQL'
mutation ($repositoryId: ID!, $title: String!, $body: String) {
createIssue(input: {repositoryId: $repositoryId, title: $title, body: $body}) {
issue {
Expand All @@ -28,16 +37,8 @@ class QueryError < StandardError; end
}
}
GRAPHQL

def initialize(params)
@title = params[:content][:title]
@body = params[:content][:body]
@repo = Rails.configuration.change_request.dig(:ontologies, params[:ont_acronym].to_sym, :repository)
end

def call
data = query(FindRepoQuery, variables: { owner: repo_owner, name: repo_name })
data = query(CreateIssueMutation, variables: { repositoryId: data.repository.id, title: @title, body: @body })
data = query(findRepoQuery, variables: { owner: repo_owner, name: repo_name })
data = query(createIssueMutation, variables: { repositoryId: data.repository.id, title: @title, body: @body })
data.to_h.dig('createIssue', 'issue')
end

Expand Down

0 comments on commit 18acf08

Please sign in to comment.