Skip to content

Commit

Permalink
fix creating issue authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew2net committed Aug 17, 2024
1 parent c6c6209 commit 120e9b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/relaton/logger/channels/gh_issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ def issue_body
def headers
{
"Content-Type" => "application/json",
"Authorization" => "token #{ENV['GITHUB_TOKEN']}",
"Accept" => "application/vnd.github+json",
"Authorization" => "Bearer #{ENV['GITHUB_TOKEN']}",
"X-GitHub-Api-Version" => "2022-11-28",
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/relaton/logger/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Relaton
module Logger
VERSION = "0.2.1"
VERSION = "0.2.2"
end
end
7 changes: 6 additions & 1 deletion spec/relaton/logger/channels/gh_issue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@

it "headers" do
expect(ENV).to receive(:[]).with("GITHUB_TOKEN").and_return("token").twice
expect(subject.send :headers).to eq({ "Content-Type" => "application/json", "Authorization" => "token token" })
expect(subject.send :headers).to eq({
"Content-Type" => "application/json",
"Accept" => "application/vnd.github+json",
"Authorization" => "Bearer token",
"X-GitHub-Api-Version" => "2022-11-28",
})
end
end

0 comments on commit 120e9b6

Please sign in to comment.