Skip to content

Commit

Permalink
Update deprecated GitHub Actions syntax (#490)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
kvfairchild and Katherine Fairchild authored Jan 10, 2024
1 parent cc481da commit 4ae469c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/automerge_plugin-only_prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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/[email protected]
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/check_if_pr_is_automergeable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,22 @@ 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
runs-on: ubuntu-latest
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 }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/score_new_plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down

0 comments on commit 4ae469c

Please sign in to comment.