Repository: python/bedevere
Pull request #562 (2023-05-22 21:17:48)

Fix label creation
The color should not include the leading #
Fixes https://github.com/python/bedevere/issues/560

Doc: https://docs.github.com/en/rest/issues/labels?apiVersion=2022-11-28#create-a-label

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/python/bedevere/pull/562?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python) Report
> Merging [#562](https://app.codecov.io/gh/python/bedevere/pull/562?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python) (3d78361) into [main](https://app.codecov.io/gh/python/bedevere/commit/c320c05ccd9e9d6fb13357e81144555a6107794e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python) (c320c05) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://app.codecov.io/gh/python/bedevere/pull/562/graphs/tree.svg?width=650&height=150&src=pr&token=S7kyeapERi&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python)](https://app.codecov.io/gh/python/bedevere/pull/562?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python)

```diff
@@            Coverage Diff            @@
##              main      #562   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           18        18           
  Lines         2083      2083           
  Branches       234       234           
=========================================
  Hits          2083      2083           
```

| Flag | Coverage Δ | |
|---|---|---|
| Python_3.10.11 | `100.00% <ø> (ø)` | |
| Python_3.11.3 | `100.00% <ø> (ø)` | |
| Python_3.8.16 | `100.00% <ø> (ø)` | |
| Python_3.9.16 | `100.00% <ø> (ø)` | |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://app.codecov.io/gh/python/bedevere/pull/562?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python) | Coverage Δ | |
|---|---|---|
| [bedevere/backport.py](https://app.codecov.io/gh/python/bedevere/pull/562?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python#diff-YmVkZXZlcmUvYmFja3BvcnQucHk=) | `100.00% <ø> (ø)` | |


Patch:
diff --git a/bedevere/backport.py b/bedevere/backport.py
index 0df62ce..42b7041 100644
--- a/bedevere/backport.py
+++ b/bedevere/backport.py
@@ -130,5 +130,5 @@ async def maintenance_branch_created(event, gh, *args, **kwargs):
     if MAINTENANCE_BRANCH_RE.match(branch_name):
         await gh.post(
             "/repos/python/cpython/labels",
-            data={"name": f"needs backport to {branch_name}", "color": "#c2e0c6"},
+            data={"name": f"needs backport to {branch_name}", "color": "c2e0c6"},
         )


Test patch:
diff --git a/tests/test_backport.py b/tests/test_backport.py
index 605ad57..d148ec4 100644
--- a/tests/test_backport.py
+++ b/tests/test_backport.py
@@ -452,7 +452,7 @@ async def test_maintenance_branch_created(ref):
     await backport.router.dispatch(event, gh)
     label_creation_post = gh.post_[0]
     assert label_creation_post[0] == "https://api.github.com/repos/python/cpython/labels"
-    assert label_creation_post[1] == {'name': f"needs backport to {ref}", 'color': '#c2e0c6'}
+    assert label_creation_post[1] == {'name': f"needs backport to {ref}", 'color': 'c2e0c6'}
 
 
 @pytest.mark.parametrize('ref', ['backport-3.9', 'test', 'Mariatta-patch-1'])