Skip to content

Commit

Permalink
Merge branch 'main' into update-ci-py-versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ezio-melotti authored May 2, 2023
2 parents 7c5767c + 77abdb0 commit b2d99a3
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 3,019 deletions.
20 changes: 10 additions & 10 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ updates:
directory: "/"
schedule:
interval: monthly
assignees:
- "ezio-melotti"
open-pull-requests-limit: 10

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: monthly
assignees:
- "ezio-melotti"
open-pull-requests-limit: 10
ignore:
- dependency-name: pytest-asyncio
versions:
- 0.15.0
- dependency-name: sentry-sdk
versions:
- 0.20.0
- 0.20.1
- 0.20.2
- 0.20.3
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
Expand All @@ -29,7 +29,7 @@ jobs:
allow-prereleases: true
- run: python3 -m pip install -U -r dev-requirements.txt
- run: pytest --cov=. --cov-report=xml
- uses: codecov/codecov-action@v2
- uses: codecov/codecov-action@v3
if: always()
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-r requirements.txt
coverage
pytest==7.2.2
pytest==7.3.1
pytest-asyncio==0.21.0
pytest-aiohttp==1.0.4
pytest-cov==4.0.0
4 changes: 2 additions & 2 deletions miss_islington/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from sentry_sdk.integrations.aiohttp import AioHttpIntegration


from . import backport_pr, check_run, delete_branch, status_change
from . import backport_pr, delete_branch

router = routing.Router(
backport_pr.router, delete_branch.router, status_change.router, check_run.router
backport_pr.router, delete_branch.router
)

cache = cachetools.LRUCache(maxsize=500)
Expand Down
34 changes: 0 additions & 34 deletions miss_islington/check_run.py

This file was deleted.

169 changes: 0 additions & 169 deletions miss_islington/status_change.py

This file was deleted.

93 changes: 0 additions & 93 deletions miss_islington/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

import gidgethub

from .status_change import AUTOMERGE_TRAILER

AUTOMERGE_LABEL = ":robot: automerge"


async def comment_on_pr(gh, issue_number, message):
Expand Down Expand Up @@ -83,93 +80,3 @@ def normalize_title(title, body):
# Being paranoid in case \r\n is used.
return title[:-1] + body[1:].partition("\r\n")[0]


def normalize_message(body):
"""Normalize the message body to make it commit-worthy.
Mostly this just means removing HTML comments, but also removes unwanted
leading or trailing whitespace.
Returns the normalized body.
"""
# Remove issue mentions added by Bedevere.
# This should catch both current gh- and legacy bpo- messages.
body = re.sub(r"(?s)<!-- (gh-)?issue-number:.*/\1issue-number -->", "", body)
# Remove other HTML comments
while "<!--" in body:
body = body[: body.index("<!--")] + body[body.index("-->") + 3 :]
# Delete BPO links on their own line, probably added by an old version of Bedevere.
body = re.sub(r"\nhttps://bugs.python.org/issue(\d+)\n", "", body)
# Strip additional newlines between commit body and automerge label.
body_parts = body.split(AUTOMERGE_TRAILER)
if len(body_parts) > 1:
body, automerge_user = body_parts
body = f"{body.strip()}\n\n{AUTOMERGE_TRAILER}{automerge_user}"
return "\n\n" + body.strip()


# Copied over from https://github.com/python/bedevere
async def is_core_dev(gh, username):
"""Check if the user is a CPython core developer."""
org_teams = "/orgs/python/teams"
team_name = "python core"
async for team in gh.getiter(org_teams):
if team["name"].lower() == team_name: # pragma: no branch
break
else:
raise ValueError(f"{team_name!r} not found at {org_teams!r}")
# The 'teams' object only provides a URL to a deprecated endpoint,
# so manually construct the URL to the non-deprecated team membership
# endpoint.
membership_url = f"/teams/{team['id']}/memberships/{username}"
try:
await gh.getitem(membership_url)
except gidgethub.BadRequest as exc:
if exc.status_code == 404:
return False
raise
else:
return True


def pr_is_awaiting_merge(pr_labels):
label_names = [label["name"] for label in pr_labels]
if (
"DO-NOT-MERGE" not in label_names
and "awaiting merge" in label_names
and "CLA not signed" not in label_names
):
return True
return False


def pr_is_automerge(pr_labels):
for label in pr_labels:
if label["name"] == AUTOMERGE_LABEL:
return True
return False


async def get_pr_for_commit(gh, sha):
prs_for_commit = await gh.getitem(
f"/search/issues?q=type:pr+repo:python/cpython+sha:{sha}"
)
if prs_for_commit["total_count"] > 0: # there should only be one
pr_for_commit = prs_for_commit["items"][0]
return pr_for_commit
return None


async def remove_automerge(gh, pr_data):
"""Remove the automerge label"""
await gh.delete(
f"{pr_data['issue_url']}/labels/{AUTOMERGE_LABEL}",
accept="application/vnd.github.symmetra-preview+json",
)


async def get_check_runs_for_sha(gh, sha):
return await gh.getitem(
f"/repos/python/cpython/commits/{sha}/check-runs",
accept="application/vnd.github.antiope-preview+json",
)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ gidgethub==5.2.1
cachetools==5.3.0
redis==4.5.4
celery==5.2.7
sentry-sdk==1.18.0
sentry-sdk==1.21.1
click==8.1.3

# workaround for celery/kombu#1600
Expand Down
Loading

0 comments on commit b2d99a3

Please sign in to comment.