From e1781f3cc2fa519edda18fd04b3c75d208876d44 Mon Sep 17 00:00:00 2001 From: Katherine Fairchild Date: Mon, 8 Jan 2024 00:25:07 -0500 Subject: [PATCH] Avoid package installation in automerge by moving SHA lookup from import to script (#477) * double -> single quotes for pr_head_sha retrieval * sha from status url -> branches commit * python import -> script (avoid pkg installation) --------- Co-authored-by: Katherine Fairchild --- .github/workflows/automerge_plugin-only_prs.yml | 4 ++-- brainscore_vision/submission/check_test_status.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/automerge_plugin-only_prs.yml b/.github/workflows/automerge_plugin-only_prs.yml index a7d13faa5..d3315dce3 100644 --- a/.github/workflows/automerge_plugin-only_prs.yml +++ b/.github/workflows/automerge_plugin-only_prs.yml @@ -35,9 +35,9 @@ jobs: - name: Get test results and ensure automergeable id: gettestresults run: | - echo "pr_head_sha=$( python -c 'from brainscore_vision.submission.check_test_status import print_pr_head_sha; print_pr_head_sha()' )" + echo "pr_head_sha=$( python brainscore_vision/submission/check_test_status.py get_sha )" echo "Checking test results for SHA $pr_head_sha" - echo "test_results=$( python brainscore_vision/submission/check_test_status.py $TRIGGER_SHA )" + echo "test_results=$( python brainscore_vision/submission/check_test_status.py check_tests )" echo "::set-output name=TEST_RESULTS::$test_results" diff --git a/brainscore_vision/submission/check_test_status.py b/brainscore_vision/submission/check_test_status.py index 3a82d0d25..84f2d80a2 100644 --- a/brainscore_vision/submission/check_test_status.py +++ b/brainscore_vision/submission/check_test_status.py @@ -78,9 +78,13 @@ def is_labeled_automerge(check_runs_json: dict) -> bool: if __name__ == "__main__": + if sys.argv[1] == "get_sha": + print_pr_head_sha() + sys.exit() + pr_head_sha = get_pr_head_sha() if not pr_head_sha: - print(False) + print(None) sys.exit() check_runs_json = get_data(f"{BASE_URL}/commits/{pr_head_sha}/check-runs")