Skip to content
This repository was archived by the owner on Apr 4, 2024. It is now read-only.

Fix sync_patch's use of draft field #1685

Merged

Conversation

Gabriella439
Copy link
Contributor

The map returned by Jason.decode uses strings for keys and not atoms:

>>> {:ok, json} = Jason.decode(~s({ "draft": true }))
{:ok, %{"draft" => true}}
>>> json
%{"draft" => true}

… which meant that pr[:draft] would always return nil and so bors-ng would never detect that a PR was in the draft state:

>>> json[:draft]
nil
>>> json["draft"]
true

The fix is to check for pr["draft"], which fixes the problem.

This wasn't caught by the tests because the tests create a map with atom keys, which didn't trigger this problem.

The map returned by `Jason.decode` uses strings for keys and not atoms:

```elixir
>>> {:ok, json} = Jason.decode(~s({ "draft": true }))
{:ok, %{"draft" => true}}
>>> json
%{"draft" => true}
```

… which meant that `pr[:draft]` would always return `nil` and so
`bors-ng` would never detect that a PR was in the draft state:

```elixir
>>> json[:draft]
nil
>>> json["draft"]
true
```

The fix is to check for `pr["draft"]`, which fixes the problem.

This wasn't caught by the tests because the tests create a map with
atom keys, which didn't trigger this problem.
@notriddle notriddle added this pull request to the merge queue Jun 22, 2023
Merged via the queue into bors-ng:master with commit 390d998 Jun 22, 2023
notriddle added a commit to bors-ng/bors-ng.github.io that referenced this pull request Jul 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants