Skip to content
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
7 changes: 5 additions & 2 deletions .github/workflows/evergreen.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .github/workflows/evergreen.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ imports:

steps:
- name: Find a PR that needs attention
id: find-pr
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
Expand All @@ -57,6 +58,14 @@ steps:
import os, json, re, subprocess, sys
import urllib.request, urllib.error

def emit_selected_output(pr_number):
"""Expose `selected` as a step output for workflow gating.
Empty string means no PR needs attention; otherwise the PR number."""
gh_output = os.environ.get("GITHUB_OUTPUT")
if gh_output:
with open(gh_output, "a") as f:
f.write(f"selected={'' if pr_number is None else pr_number}\n")

token = os.environ.get("GITHUB_TOKEN", "")
repo = os.environ.get("GITHUB_REPOSITORY", "")
forced_pr = os.environ.get("FORCED_PR", "").strip()
Expand Down Expand Up @@ -182,6 +191,7 @@ steps:
print("No open PRs. Nothing to do.")
with open(output_file, "w") as f:
json.dump({"selected": None, "reason": "no_open_prs"}, f)
emit_selected_output(None)
sys.exit(0)

# Evaluate each PR deterministically (sorted by PR number ascending)
Expand Down Expand Up @@ -256,8 +266,10 @@ steps:
print(f"\n>>> Selected PR #{selected['pr_number']}: {selected['title']}")
print(f" Issues: {selected['issues']}")
print(f" Attempt: {selected['attempts'] + 1}/{MAX_ATTEMPTS}")
emit_selected_output(selected["pr_number"])
else:
print("\nNo PRs need attention. Nothing to do.")
emit_selected_output(None)
sys.exit(0)
PYEOF

Expand Down
Loading