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

Adds mergeable state property in the Github PR struct #318

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Juanpe
Copy link

@Juanpe Juanpe commented Feb 13, 2020

This PR adds new property in Github PR struct. This property is mergeable. It indicates whether or not the pull request can be merged based on the existence of merge conflicts.

You can find more details in Github API documentation:

The motivation is that it could be useful to know if the PR is mergeable or not. For example to add a label like merge conflicts

@danger-public
Copy link

danger-public commented Feb 13, 2020

Fails
🚫

danger-swift` failed.

Log

�[31mERROR: Failed to parse JSON: typeMismatch(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "danger", intValue: nil), CodingKeys(stringValue: "github", intValue: nil), CodingKeys(stringValue: "pr", intValue: nil), CodingKeys(stringValue: "mergeable", intValue: nil)], debugDescription: "Expected to decode String but found a number instead.", underlyingError: nil))
�[0;0m�[31mERROR: Dangerfile eval failed at Dangerfile.swift
�[0;0m�[31mERROR: Could not get the results JSON file at /var/folders/17/5mc7816d3mndxjqgplq6057w0000gn/T/danger-response.json
�[0;0m

Generated by 🚫 dangerJS against d7b5813

@f-meloni
Copy link
Member

I think mergeable is an optional Bool on the API that danger uses.
You can verify this by running danger-swift pr https://github.com/danger/swift/pull/318 --json > file.json this will generate the json that Danger decodes on file.json

@417-72KI
Copy link
Member

417-72KI commented Sep 4, 2020

MergeableState is an object defined in GraphQL API, which seems not to be not used on danger.
Danger uses REST API, and it says

The value of the mergeable attribute can be true, false, or null. If the value is null, then GitHub has started a background job to compute the mergeability. After giving the job time to complete, resubmit the request. When the job finishes, you will see a non-null value for the mergeable attribute in the response. If mergeable is true, then merge_commit_sha will be the SHA of the test merge commit.

(ref: https://docs.github.com/en/rest/reference/pulls#get-a-pull-request)

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.

4 participants