From 22d3a64ee301a8714c4ad6fd3e3efbf25352030d Mon Sep 17 00:00:00 2001 From: Katherine Fairchild Date: Sun, 7 Jan 2024 21:31:44 -0500 Subject: [PATCH] Parse SHA from `github.event.url` on automerge workflows triggered by status events (#468) * use non-contextual github default env var * make sha conditional on trigger event * reverse conditionals for readability * use git rev-parse for non-PR event SHAs * upgrade checkout to v4 * fix typo * getting clever about extracting sha from status triggers * cleanup * update checkout to v4 --------- Co-authored-by: Katherine Fairchild --- .github/workflows/automerge_plugin-only_prs.yml | 8 ++++---- .github/workflows/score_new_plugins.yml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/automerge_plugin-only_prs.yml b/.github/workflows/automerge_plugin-only_prs.yml index fd7c453fd..2e601a3aa 100644 --- a/.github/workflows/automerge_plugin-only_prs.yml +++ b/.github/workflows/automerge_plugin-only_prs.yml @@ -34,12 +34,12 @@ jobs: fetch-depth: 0 - name: Get SHA of last commit on PR branch run: | - if [ [ ${{ github.event_name }} == "pull_request" ]]; then - echo "TRIGGER_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV + if [[ ${{ github.event_name }} == "status" ]]; then + echo "TRIGGER_SHA=${{ github.event.url##*/ }}" >> $GITHUB_ENV else - echo "TRIGGER_SHA=$( git rev-parse HEAD )" >> $GITHUB_ENV + echo "TRIGGER_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV fi - echo "Checking test status for SHA $TRIGGER_SHA" + echo "Checking test status for SHA ${{ env.TRIGGER_SHA }}" - name: Get test results and ensure automergeable id: gettestresults run: | diff --git a/.github/workflows/score_new_plugins.yml b/.github/workflows/score_new_plugins.yml index c0445b360..681d097d8 100644 --- a/.github/workflows/score_new_plugins.yml +++ b/.github/workflows/score_new_plugins.yml @@ -29,7 +29,7 @@ jobs: RUN_SCORE: ${{ steps.runscore.outputs.RUN_SCORE }} steps: - name: Check out repository code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -110,7 +110,7 @@ jobs: 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@v2 + uses: actions/checkout@v4 - name: Set up Python 3.7 uses: actions/setup-python@v4