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

Dependabot Slack repo: add combined link #708

Merged
merged 4 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions tests/workspace/test_dependabot_rota.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@

TEAM_REX = [People.JON, People.LUCY, People.KATIE]

EXTRA_TEXT = (
"\nReview repos <https://github.com/opensafely-core/job-server/pulls|job-server>, "
"<https://github.com/opensafely-core/opencodelists/pulls|opencodelists>, "
"<https://github.com/ebmdatalab/metrics/pulls|metrics>, "
"<https://github.com/opensafely-core/reports/pulls|reports>, "
"<https://github.com/opensafely-core/actions-registry/pulls|actions-registry> "
"and <https://github.com/opensafely-core/research-template-docker/pulls|research-template-docker>. "
"<https://github.com/pulls?q=is%3Apr+is%3Aopen+repo%3A"
"opensafely-core%2Fjob-server+"
"repo%3Aopensafely-core%2Fopencodelists+"
"repo%3Aebmdatalab%2Fmetrics+"
"repo%3Aopensafely-core%2Freports+"
"repo%3Aopensafely-core%2Factions-registry+"
"repo%3Aopensafely-core%2Fresearch-template-docker"
"|Combined link>. "
"Merge any outstanding non-NPM Dependabot/update-dependencies-action PRs."
"\nReview Thomas' PRs for NPM updates.\n"
)


def test_rota_report_on_monday(freezer, monkeypatch):
freezer.move_to("2024-03-25")
Expand All @@ -31,7 +50,7 @@ def test_rota_report_on_monday(freezer, monkeypatch):
},
{
"text": {
"text": "\nReview <https://github.com/opensafely-core/job-server/pulls|job-server>, <https://github.com/opensafely-core/opencodelists/pulls|opencodelists>, <https://github.com/ebmdatalab/metrics/pulls|metrics>, <https://github.com/opensafely-core/reports/pulls|reports>, <https://github.com/opensafely-core/actions-registry/pulls|actions-registry> and <https://github.com/opensafely-core/research-template-docker/pulls|research-template-docker> repos and merge any outstanding non-NPM Dependabot/update-dependencies-action PRs.\nReview Thomas' PRs for NPM updates.\n",
"text": EXTRA_TEXT,
"type": "mrkdwn",
},
"type": "section",
Expand Down Expand Up @@ -63,7 +82,7 @@ def test_rota_report_on_tuesday(freezer, monkeypatch):
},
{
"text": {
"text": "\nReview <https://github.com/opensafely-core/job-server/pulls|job-server>, <https://github.com/opensafely-core/opencodelists/pulls|opencodelists>, <https://github.com/ebmdatalab/metrics/pulls|metrics>, <https://github.com/opensafely-core/reports/pulls|reports>, <https://github.com/opensafely-core/actions-registry/pulls|actions-registry> and <https://github.com/opensafely-core/research-template-docker/pulls|research-template-docker> repos and merge any outstanding non-NPM Dependabot/update-dependencies-action PRs.\nReview Thomas' PRs for NPM updates.\n",
"text": EXTRA_TEXT,
"type": "mrkdwn",
},
"type": "section",
Expand Down
32 changes: 21 additions & 11 deletions workspace/dependabot/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,30 @@ def get_rota_text_for_week(


def report_rota() -> str:
return DependabotRotaReporter(
title="Dependabot rota",
).report(
"\nReview "
"<https://github.com/opensafely-core/job-server/pulls|job-server>, "
"<https://github.com/opensafely-core/opencodelists/pulls|opencodelists>, "
"<https://github.com/ebmdatalab/metrics/pulls|metrics>, "
"<https://github.com/opensafely-core/reports/pulls|reports>, "
"<https://github.com/opensafely-core/actions-registry/pulls|actions-registry> and "
"<https://github.com/opensafely-core/research-template-docker/pulls|research-template-docker> "
"repos and merge any outstanding non-NPM Dependabot/update-dependencies-action PRs.\n"
repos = [
("opensafely-core", "job-server"),
("opensafely-core", "opencodelists"),
("ebmdatalab", "metrics"),
("opensafely-core", "reports"),
("opensafely-core", "actions-registry"),
("opensafely-core", "research-template-docker"),
]
repo_links = [
f"<https://github.com/{org}/{repo}/pulls|{repo}>" for org, repo in repos
]
combined_link = "https://github.com/pulls?q=is%3Apr+is%3Aopen+" + "+".join(
f"repo%3A{org}%2F{repo}" for org, repo in repos
)

repo_links_text = ", ".join(repo_links[:-1]) + " and " + repo_links[-1]
extra_text = (
f"\nReview repos {repo_links_text}. <{combined_link}|Combined link>. "
"Merge any outstanding non-NPM Dependabot/update-dependencies-action PRs.\n"
"Review Thomas' PRs for NPM updates.\n"
)

return DependabotRotaReporter(title="Dependabot rota").report(extra_text)


if __name__ == "__main__":
print(report_rota())