From 4ae469cddce66b05cc7fdfafc45071ef25c673f4 Mon Sep 17 00:00:00 2001 From: Katherine Fairchild Date: Wed, 10 Jan 2024 08:42:27 -0500 Subject: [PATCH] Update deprecated GitHub Actions syntax (#490) * fix typo * retrieve PR SHA from python (not direct in workflow) * print test results to log * remove brackets from conditionals and var setting --------- Co-authored-by: Katherine Fairchild --- .github/workflows/automerge_plugin-only_prs.yml | 10 ++++++---- .github/workflows/check_if_pr_is_automergeable.yml | 10 ++++++---- .github/workflows/score_new_plugins.yml | 12 ++++++------ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/automerge_plugin-only_prs.yml b/.github/workflows/automerge_plugin-only_prs.yml index 803882313..115688b1c 100644 --- a/.github/workflows/automerge_plugin-only_prs.yml +++ b/.github/workflows/automerge_plugin-only_prs.yml @@ -18,7 +18,7 @@ jobs: check_test_results: name: Check if all tests have passed and PR meets automerge conditions runs-on: ubuntu-latest - if: ${{ github.event.label.name == 'automerge-approved' }} + if: github.event.label.name == 'automerge-approved' outputs: ALL_TESTS_PASS: ${{ steps.gettestresults.outputs.TEST_RESULTS }} steps: @@ -29,14 +29,16 @@ jobs: - name: Get test results and ensure automergeable id: gettestresults run: | - echo "Checking test results for PR head pr_head=$( python brainscore_vision/submission/actions_helpers.py get_pr_head )" - echo "{TEST_RESULTS}={$( python brainscore_vision/submission/actions_helpers.py )}" >> $GITHUB_OUTPUT + echo "Checking test results for PR head $( python brainscore_vision/submission/actions_helpers.py get_pr_head )" + test_results=$( python brainscore_vision/submission/actions_helpers.py ) + echo $test_results + echo "TEST_RESULTS=$test_results" >> $GITHUB_OUTPUT automerge: name: If tests pass and PR is automergeable, approve and merge runs-on: ubuntu-latest needs: check_test_results - if: ${{ needs.check_test_results.outputs.ALL_TESTS_PASS == 'True' }} + if: needs.check_test_results.outputs.ALL_TESTS_PASS == 'True' steps: - name: Auto Approve uses: hmarr/auto-approve-action@v3.1.0 diff --git a/.github/workflows/check_if_pr_is_automergeable.yml b/.github/workflows/check_if_pr_is_automergeable.yml index b088acacd..66dde000c 100644 --- a/.github/workflows/check_if_pr_is_automergeable.yml +++ b/.github/workflows/check_if_pr_is_automergeable.yml @@ -37,8 +37,10 @@ jobs: - name: Get test results and ensure automergeable id: gettestresults run: | - echo "Checking test results for PR head pr_head=$( python brainscore_vision/submission/actions_helpers.py get_pr_head )" - echo "{TEST_RESULTS}={$( python brainscore_vision/submission/actions_helpers.py )}" >> $GITHUB_OUTPUT + echo "Checking test results for PR head $( python brainscore_vision/submission/actions_helpers.py get_pr_head )" + test_results=$( python brainscore_vision/submission/actions_helpers.py ) + echo $test_results + echo "TEST_RESULTS=$test_results" >> $GITHUB_OUTPUT approve_automerge: name: If tests pass and PR is automergeable, apply "approve_automerge" label to PR @@ -46,11 +48,11 @@ jobs: permissions: issues: write needs: check_test_results - if: ${{ needs.check_test_results.outputs.ALL_TESTS_PASS == 'True' }} + if: needs.check_test_results.outputs.ALL_TESTS_PASS == 'True' steps: - name: Get PR number from workflow context run: | - echo "{PR_NUMBER}={$( python brainscore_vision/submission/actions_helpers.py get_pr_num )}" >> $GITHUB_ENV + echo "PR_NUMBER=$( python brainscore_vision/submission/actions_helpers.py get_pr_num )" >> $GITHUB_ENV - name: Add automerge-approved label to PR env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/score_new_plugins.yml b/.github/workflows/score_new_plugins.yml index 681d097d8..2c3632528 100644 --- a/.github/workflows/score_new_plugins.yml +++ b/.github/workflows/score_new_plugins.yml @@ -63,20 +63,20 @@ jobs: name: Get PR author email and (if web submission) Brain-Score user ID runs-on: ubuntu-latest needs: [changes_models_or_benchmarks] - if: ${{ needs.changes_models_or_benchmarks.outputs.RUN_SCORE == 'True' }} + if: needs.changes_models_or_benchmarks.outputs.RUN_SCORE == 'True' env: - PLUGIN_INFO: ${{ needs.changes_models_or_benchmarks.outputs.PLUGIN_INFO }} + PLUGIN_INFO: needs.changes_models_or_benchmarks.outputs.PLUGIN_INFO outputs: - PLUGIN_INFO: ${{ steps.add_email_to_pluginfo.outputs.PLUGIN_INFO }} + PLUGIN_INFO: steps.add_email_to_pluginfo.outputs.PLUGIN_INFO steps: - name: Parse user ID from PR title (WEB ONLY where we don't have access to the GitHub user) id: getuid - if: ${{ github.event.pull_request.labels.*.name == 'automerge-web' }} + if: github.event.pull_request.labels.*.name == 'automerge-web' run: | echo "BS_UID="$(<<<${{ github.event.pull_request.title }} | sed -E 's/.*\(user:([^)]+)\).*/\1/'"" >> $GITHUB_ENV - name: Add user ID to PLUGIN_INFO (WEB ONLY) id: add_uid_to_pluginfo - if: ${{ github.event.pull_request.labels.*.name == 'automerge-web' }} + if: github.event.pull_request.labels.*.name == 'automerge-web' run: | echo "The Brain-Score user ID is ${{ steps.getuid.outputs.BS_UID }}" echo "PLUGIN_INFO="$(<<<$PLUGIN_INFO jq '. + {user_id: ${{ steps.getuid.outputs.UID }} }')"" >> $GITHUB_ENV @@ -98,7 +98,7 @@ jobs: name: Score plugins runs-on: ubuntu-latest needs: [changes_models_or_benchmarks, get_submitter_info] - if: ${{ needs.changes_models_or_benchmarks.outputs.RUN_SCORE == 'True' }} + if: needs.changes_models_or_benchmarks.outputs.RUN_SCORE == 'True' env: PLUGIN_INFO: ${{ needs.get_submitter_info.outputs.PLUGIN_INFO }} JENKINS_USER: ${{ secrets.JENKINS_USER }}