Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Warnings #77

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading