feat: trust contributors for test builds (#1646)

* feat: trust contributors for test builds

* fix: restrict trusted list changes

* fix: retain same-repository test signing

* fix: publish completed fork builds

* feat: trust K11MCH1 test builds

* fix: recognize maintain collaborator role
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-26 22:54:57 -04:00
1 parent 8749154cbf
commit 0e9a31ccfe
6 files changed
+144 -38

No files matched your search

+2 -5
View File
@@ -13,11 +13,8 @@ MARK="<!-- droiddeck-pr-build -->"
echo
echo "The \`droiddeck-apk\` artifact is [on this run]($RUN_URL), signed with the public test key."
echo
if [ "$SAME_REPO" = true ]; then
echo "After the parallel regression tests pass, a release-signed tester build that installs over Stable or Preview will be published and will appear in DroidDeck's **Test builds** list. Label the PR \`no-test-build\` to skip that."
else
echo "**Maintainer:** add the \`publish-test\` label to publish a release-signed tester build that installs over Stable or Preview and appears in DroidDeck's **Test builds** list. The label is removed automatically after publishing."
fi
echo "Same-repository PRs and PRs opened by contributors listed in \`.github/trusted-test-builds.txt\` are eligible for automatic release-signed test builds after the full build passes. Label the PR \`no-test-build\` to skip that."
echo "For other PRs, a maintainer can add the \`publish-test\` label to request a signed build."
echo
echo "Fallback: [open **PR Release Publish**]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/workflows/pr-release-publish.yml) on \`main\` and enter PR \`$PR\`."
;;
+17
View File
@@ -34,6 +34,22 @@ def documentation_only(sha):
return all(path.endswith(b".md") or path in (b"LICENSE", b".gitignore") for path in paths if path)
def trusted_list_violation(repo, pr, sha):
changed = subprocess.run(
["git", "diff", "--no-renames", "--quiet", f"origin/main...{sha}", "--", ".github/trusted-test-builds.txt"],
check=False,
)
if changed.returncode not in (0, 1):
raise RuntimeError("Could not check trusted contributor changes")
if changed.returncode == 0:
return []
opener = pr["user"]["login"]
permission = api(f"repos/{repo}/collaborators/{opener}/permission")
if permission["permission"] != "admin" and permission.get("role_name") != "maintain":
return [f"Only a maintainer may open a PR changing .github/trusted-test-builds.txt (opened by @{opener})"]
return []
def main():
with open(os.environ["GITHUB_EVENT_PATH"], encoding="utf-8") as source:
event = json.load(source)
@@ -76,6 +92,7 @@ def main():
commits, errors = check_revision(sha)
if pr:
errors.extend(event_violations({"pull_request": pr}))
errors.extend(trusted_list_violation(repo, pr, sha))
if errors:
raise RuntimeError("\n".join(errors))
print(f"Source and metadata validated for {len(commits)} commits")