Skip to content

Commit

Permalink
Merge pull request #77 from RodrigoMNardi/bug/github/warning_reactions
Browse files Browse the repository at this point in the history
GitHub Warnings
  • Loading branch information
RodrigoMNardi authored Jun 17, 2024
2 parents 15f14ba + f2cd69f commit 194bcd5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 8 additions & 6 deletions lib/github/check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,21 @@ def add_comment(pr_id, comment, repo)
end

def comment_reaction_thumb_up(repo, comment_id)
@app.create_issue_comment_reaction(repo, comment_id, '+1')
@app.create_issue_comment_reaction(repo, comment_id, '+1',
accept: Octokit::Preview::PREVIEW_TYPES[:reactions])
end

def comment_reaction_thumb_down(repo, comment_id)
@app.create_issue_comment_reaction(repo, comment_id, '-1')
@app.create_issue_comment_reaction(repo, comment_id, '-1',
accept: Octokit::Preview::PREVIEW_TYPES[:reactions])
end

def create(name)
@app.create_check_run(
@check_suite.pull_request.repository,
name,
@check_suite.commit_sha_ref,
accept: 'application/vnd.github.antiope-preview+json'
accept: Octokit::Preview::PREVIEW_TYPES[:checks]
)
end

Expand Down Expand Up @@ -94,7 +96,7 @@ def skipped(check_ref, output = {})
def get_check_run(check_ref)
@app.check_run(@check_suite.pull_request.repository,
check_ref,
accept: 'application/vnd.github.antiope-preview+json').to_h
accept: Octokit::Preview::PREVIEW_TYPES[:checks]).to_h
end

def fetch_check_runs
Expand All @@ -104,7 +106,7 @@ def fetch_check_runs
.check_runs_for_ref(
@check_suite.pull_request.repository,
@check_suite.pull_request.branch_name,
accept: 'application/vnd.github.antiope-preview+json'
accept: Octokit::Preview::PREVIEW_TYPES[:checks]
)
.to_h[:check_runs]
.map do |check_run|
Expand Down Expand Up @@ -135,7 +137,7 @@ def fetch_username(username)
def basic_status(check_ref, status, output)
opts = {
status: status,
accept: 'application/vnd.github.antiope-preview+json'
accept: Octokit::Preview::PREVIEW_TYPES[:checks]
}

opts[:output] = output unless output.empty?
Expand Down
4 changes: 3 additions & 1 deletion spec/lib/github/check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@
let(:pr_info) { { comment_id: comment_id } }

before do
allow(fake_client).to receive(:create_issue_comment_reaction).with(repo, comment_id, '+1').and_return(pr_info)
allow(fake_client).to receive(:create_issue_comment_reaction)
.with(repo, comment_id, '+1', accept: Octokit::Preview::PREVIEW_TYPES[:reactions])
.and_return(pr_info)
end

it 'must returns pull request info' do
Expand Down

0 comments on commit 194bcd5

Please sign in to comment.