Skip to content
Merged
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
24 changes: 24 additions & 0 deletions adabot/lib/circuitpython_library_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def get_result(self):
ERROR_GITHUB_COMMITS_SINCE_LAST_RELEASE_GTM = "Library has new commits since last release over a month ago"
ERROR_GITHUB_COMMITS_SINCE_LAST_RELEASE_1M = "Library has new commits since last release within the last month"
ERROR_GITHUB_COMMITS_SINCE_LAST_RELEASE_1W = "Library has new commits since last release within the last week"
ERROR_GITHUB_FAILING_ACTIONS = "The most recent GitHub Actions run has failed"
ERROR_RTD_MISSING_LATEST_RELEASE = "ReadTheDocs missing the latest release. (Ignore me! RTD doesn't update when a new version is released. Only on pushes.)"
ERROR_DRIVERS_PAGE_DOWNLOAD_FAILED = "Failed to download drivers page from CircuitPython docs"
ERROR_DRIVERS_PAGE_DOWNLOAD_MISSING_DRIVER = "CircuitPython drivers page missing driver"
Expand Down Expand Up @@ -257,6 +258,29 @@ def validate_repo_state(self, repo):
errors.append(ERROR_ONLY_ALLOW_MERGES)
return errors

def validate_actions_state(self, repo):
"""Validate if the most recent GitHub Actions run on the default branch
has passed.
Just returns a message stating that the most recent run failed.
"""
if not (repo["owner"]["login"] == "adafruit" and
repo["name"].startswith("Adafruit_CircuitPython")):
return []

actions_params = {"branch": repo["default_branch"]}
response = github.get(
"/repos/" + repo["full_name"] + "/actions/runs",
params=actions_params)

if not response.ok:
return [ERROR_UNABLE_PULL_REPO_DETAILS]

workflow_runs = response.json()["workflow_runs"]
if workflow_runs and workflow_runs[0]["conclusion"] == "failure":
return [ERROR_GITHUB_FAILING_ACTIONS]
return []


def validate_release_state(self, repo):
"""Validate if a repo 1) has a release, and 2) if there have been commits
since the last release. Only files that drive user-facing changes
Expand Down