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
21 changes: 3 additions & 18 deletions .github/scripts/ep_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,8 @@ def gh(args):

def get_changed_files(pr_number):
raw = gh(["api", f"repos/{REPO}/pulls/{pr_number}/files",
"--paginate", "--jq", "[.[].filename]"])
return json.loads(raw) if raw.strip() else []


def get_incremental_files(before_sha, head_sha):
raw = gh(["api", f"repos/{REPO}/compare/{before_sha}...{head_sha}",
"--jq", "[.files[].filename]"])
return json.loads(raw) if raw.strip() else []
"--paginate", "--jq", ".[].filename"])
return [f for f in raw.splitlines() if f.strip()]


def detect_skills(files):
Expand Down Expand Up @@ -119,16 +113,7 @@ def main():
if shadow:
print("SHADOW MODE: review will run but no comment will be posted")

event_name = os.environ.get("EVENT_NAME", "")
event_action = os.environ.get("EVENT_ACTION", "")
before_sha = os.environ.get("EVENT_BEFORE_SHA", "")

# For synchronize events, only review files changed in the latest push
if event_action == "synchronize" and before_sha and head_sha:
files = get_incremental_files(before_sha, head_sha)
print(f"Synchronize: checking incremental diff ({before_sha[:8]}..{head_sha[:8]})")
else:
files = get_changed_files(pr_number)
files = get_changed_files(pr_number)
Comment thread
eranco74 marked this conversation as resolved.

if not files:
print("No files changed")
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/ep-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ jobs:
EP_REVIEW_SHADOW: ${{ vars.EP_REVIEW_SHADOW || 'true' }}
PR_NUMBER: ${{ needs.resolve-pr.outputs.pr_number }}
PR_HEAD_SHA: ${{ needs.resolve-pr.outputs.head_sha }}
EVENT_NAME: ${{ github.event_name }}
EVENT_ACTION: ${{ github.event.action }}
EVENT_BEFORE_SHA: ${{ github.event.before }}
run: python .github/scripts/ep_review.py

- name: Upload OTEL metrics
Expand Down
Loading