Skip to content

Commit

Permalink
Avoid package installation in automerge by moving SHA lookup from imp…
Browse files Browse the repository at this point in the history
…ort 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 <[email protected]>
  • Loading branch information
kvfairchild and Katherine Fairchild authored Jan 8, 2024
1 parent fde77f0 commit e1781f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/automerge_plugin-only_prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion brainscore_vision/submission/check_test_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit e1781f3

Please sign in to comment.