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

Fix pr_draft? GitHub Method #1340

Merged
merged 1 commit into from
Dec 17, 2021
Merged

Fix pr_draft? GitHub Method #1340

merged 1 commit into from
Dec 17, 2021

Conversation

rogerluan
Copy link
Contributor

Description

This PR resolves #1338

My best guess is that there was a change in GitHub's API functionality and the mergeable state now doesn't return "draft" when the PR is a PR. In fact, now there's this dedicated API, so we should just be using it anyway 😊

Tests

Dangerfile:

if defined?(github) and github.pr_draft?
  message("Test: skipping early")
  return
else
if defined?(github)
  is_github_defined = true
else
  is_github_defined = false
end
if is_github_defined
  is_draft_pr = github.pr_draft?
  if github.pr_json['draft']
      message("github.pr_json['draft'] = true")
  end
end
message("Test: not skipping. is_github_defined  = #{is_github_defined}, is_draft_pr = #{is_draft_pr}")
message("#{github.pr_json['draft']}")
message("#{github.pr_json.inspect}")

Before

image

After

image

@rogerluan rogerluan changed the title Fix pr_draft? GitHub method. Fix pr_draft? GitHub Method Dec 17, 2021
@orta
Copy link
Member

orta commented Dec 17, 2021

Perfect answer IMO

@orta orta merged commit 4300005 into danger:master Dec 17, 2021
@rogerluan rogerluan deleted the fix-draft-status branch December 17, 2021 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

github.pr_draft? is returning false even though the PR is a draft
2 participants