From 8fe2ab7e111ed8a937d55d753d0ee5587d1bbc21 Mon Sep 17 00:00:00 2001 From: Katherine Fairchild Date: Fri, 12 Jan 2024 14:53:26 -0500 Subject: [PATCH] Convert `BS_UID` to string and general cleanup of scoring pipeline (#510) * cast BS_UID to string * only treat PLUGIN_INFO as JSON (not string) * cleanup * typo * Clarify check if scoring needed job name * curly brackets around needs & steps --------- Co-authored-by: Katherine Fairchild --- .github/workflows/score_new_plugins.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/score_new_plugins.yml b/.github/workflows/score_new_plugins.yml index ad0239103..7aef50679 100644 --- a/.github/workflows/score_new_plugins.yml +++ b/.github/workflows/score_new_plugins.yml @@ -52,23 +52,22 @@ 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 + 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 - name: Check if scoring needed id: scoringneeded run: | echo "RUN_SCORING=$(jq -r '.run_score' <<< ${{ steps.getpluginfo.outputs.PLUGIN_INFO }})" >> $GITHUB_OUTPUT - get_submitter_info: 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_SCORING == 'True' env: - PLUGIN_INFO: $(<<< ${{ needs.changes_models_or_benchmarks.outputs.PLUGIN_INFO }} tr -d "'") # str -> JSON + 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 and add to PLUGIN_INFO (WEB ONLY where we don't have access to the GitHub user) id: add_uid_to_pluginfo @@ -76,7 +75,7 @@ jobs: run: | BS_UID="$(echo '${{ github.event.pull_request.title }}' | sed -E 's/.*\(user:([^)]+)\).*/\1/')" echo "The Brain-Score user ID is $BS_UID" - printf "PLUGIN_INFO=$(<<<$PLUGIN_INFO jq ". + {user_id: \"$BS_UID\"}")" >> $GITHUB_ENV + echo "PLUGIN_INFO=$(<<<$PLUGIN_INFO tr -d "'" | jq -c ". + {user_id: \"$BS_UID\"}")" >> $GITHUB_ENV - name: Get PR author email from GitHub username id: getemail @@ -88,7 +87,7 @@ jobs: id: add_email_to_pluginfo run: | echo "The PR author email is ${{ steps.getemail.outputs.email }}" - printf "PLUGIN_INFO=$(<<<$PLUGIN_INFO jq ". + {author_email: \"${{ steps.getemail.outputs.email }}\"}")" >> $GITHUB_OUTPUT + echo "PLUGIN_INFO=$(<<<$PLUGIN_INFO tr -d "'" | jq -c '. + {author_email: "${{ steps.getemail.outputs.email }}"}')" >> $GITHUB_OUTPUT run_scoring: name: Score plugins @@ -103,7 +102,7 @@ jobs: steps: - name: Add domain, public, competition, and model_type to PLUGIN_INFO run: | - echo "PLUGIN_INFO=$(echo "$PLUGIN_INFO" | jq -c '. + {domain: "vision", public: true, competition: "None", model_type: "Brain_Model"}')" >> $GITHUB_ENV + echo "PLUGIN_INFO=$(<<<$PLUGIN_INFO tr -d "'" | jq -c '. + {domain: "vision", public: true, competition: "None", model_type: "Brain_Model"}')" >> $GITHUB_ENV - name: Check out repository code uses: actions/checkout@v4 @@ -116,8 +115,8 @@ jobs: - name: Build project run: | python -m pip install --upgrade pip setuptools - python -m pip install ".[test]" + python -m pip install "." - 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 }}'\'')'