From ede29dc5414c9c3f11a6f5f1330da306f30ef094 Mon Sep 17 00:00:00 2001 From: Katherine Fairchild Date: Thu, 11 Jan 2024 13:03:35 -0500 Subject: [PATCH] Clean up scoring action (#500) * check array for automerge-web label * upgrade get-github-email-by-username-action version * fix BS_UID reference * cleanup * typo * typo --------- Co-authored-by: Katherine Fairchild --- .github/workflows/score_new_plugins.yml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/score_new_plugins.yml b/.github/workflows/score_new_plugins.yml index 2c3632528..840cf8bcd 100644 --- a/.github/workflows/score_new_plugins.yml +++ b/.github/workflows/score_new_plugins.yml @@ -52,7 +52,8 @@ jobs: - name: Get plugin info id: getpluginfo run: | - echo "PLUGIN_INFO='$(python -c 'from brainscore_core.plugin_management.parse_plugin_changes import get_scoring_info; get_scoring_info("${{ env.CHANGED_FILES }}", "brainscore_vision")')'" >> $GITHUB_OUTPUT + printf -v PLUGIN_INFO "%s" "$(python -c 'from brainscore_core.plugin_management.parse_plugin_changes import get_scoring_info; get_scoring_info("brainscore_vision/models/regnet/__init__.py brainscore_vision/models/regnet/model.py brainscore_vision/models/regnet/test.py ", "brainscore_vision")')" + echo "PLUGIN_INFO=$PLUGIN_INFO" >> $GITHUB_OUTPUT - name: Run scoring id: runscore @@ -69,21 +70,17 @@ jobs: outputs: 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' - 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) + - name: Parse user ID from PR title and add to PLUGIN_INFO (WEB ONLY where we don't have access to the GitHub user) id: add_uid_to_pluginfo - if: github.event.pull_request.labels.*.name == 'automerge-web' + if: contains(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 + BS_UID="$(<<<${{ github.event.pull_request.title }} sed -E 's/.*\(user:([^)]+)\).*/\1/')" + echo "The Brain-Score user ID is $BS_UID" + echo "PLUGIN_INFO="$(<<<$PLUGIN_INFO jq '. + {user_id: ${{ steps.getuid.outputs.BS_UID }} }')"" >> $GITHUB_ENV - name: Get PR author email from GitHub username id: getemail - uses: evvanErb/get-github-email-by-username-action@v1.25 + uses: evvanErb/get-github-email-by-username-action@v2.0 with: github-username: ${{github.event.pull_request.user.login}} # PR author's username token: ${{ secrets.GITHUB_TOKEN }} # Including token enables most reliable way to get a user's email @@ -124,4 +121,4 @@ jobs: - name: Run scoring run: | - python -c 'from brainscore_core.submission.endpoints import call_jenkins; call_jenkins('\''${{ env.PLUGIN_INFO }}'\'')' + python -c "from brainscore_core.submission.endpoints import call_jenkins; call_jenkins('\''${{ env.PLUGIN_INFO }}'\'')"