From 3ec87d74cdfee76aca332f2c44b025f441f84b20 Mon Sep 17 00:00:00 2001 From: Johnnie Birch Date: Mon, 12 Sep 2022 23:47:31 -0700 Subject: [PATCH] Use jq to get patch author information and fix pr fetch --- .github/workflows/performance.yml | 39 +++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index b06d93f051dd..37f59a64ae34 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -23,12 +23,24 @@ jobs: Wasmtime_Repo_On_PR_Comment: name: Benchmark x64 on PR comment Wasmtime repo runs-on: ubuntu-latest -# if: (github.event_name == 'push') && (github.repository != 'bytecodealliance/wasmtime-sightglass-benchmarking') -# if: | -# startsWith(github.event.review_comment.body, '/bench_x64') +# if: (github.event_name == 'pull_request_review') && (github.repository == 'bytecodealliance/wasmtime-sightglass-benchmarking') + if: | + (github.event_name == 'pull_request_review') && + (startsWith(github.event.review.body, '/bench_x64')) && + (('abrown' == github.event.review.user.login) + || ('afonso360' == github.event.review.user.login) + || ('akirilov-arm' == github.event.review.user.login) + || ('alexcrichton' == github.event.review.user.login) + || ('bbouvier' == github.event.review.user.login) + || ('bjorn3' == github.event.review.user.login) + || ('cfallin' == github.event.review.user.login) + || ('fitzgen' == github.event.review.user.login) + || ('jlb6740' == github.event.review.user.login) + || ('sparker-arm' == github.event.review.user.login) + || ('uweigand' == github.event.review.user.login)) steps: - run: echo "MESSAGE=Requested from pull request comment." >> $GITHUB_ENV - - run: echo "ACTOR=${{ github.event.comment.user.login }}" >> $GITHUB_ENV + - run: echo "ACTOR=${{ github.event.review.user.login }}" >> $GITHUB_ENV - run: echo "REPOSITORY=${{ github.repository }}" >> $GITHUB_ENV - run: echo "REFS=${{ github.ref }}" >> $GITHUB_ENV - run: echo "PR_NUMBER=${{ github.event.issue.number }}" >> $GITHUB_ENV @@ -40,16 +52,19 @@ jobs: git clone https://jlb6740:${{env.TOKEN}}@github.com/bytecodealliance/wasmtime-sightglass-benchmarking.git cd wasmtime-sightglass-benchmarking git remote add wasmtime ${{ github.event.repository.clone_url }} - git fetch wasmtime - git checkout wasmtime/${{ github.ref_name }} -b ${{ github.ref_name }} + git fetch wasmtime refs/pull/*/merge:refs/remotes/wasmtime/pull/*/merge + git checkout wasmtime/pull/${{ github.ref_name }} -b ${{ github.ref_name }} git submodule update --init --recursive - git checkout -b wasmtime-performance-testing/FB/${{ github.ref_name }}/${{ github.sha }} - echo ${{ github.event.commits[0].committer.name }} - echo "email - ${{ github.event.commits[0].committer.email }}" - git config user.name '${{ github.event.commits[0].committer.name }}' - git config user.email '${{ github.event.commits[0].committer.email }}' + git checkout -b wasmtime-performance-testing/${{ github.ref }}/${{ github.sha }} + sudo apt install jq + export commit_url=${{ github.event.pull_request._links.commits.href }} + echo $commit_url + echo $(curl -sSL $commit_url | jq -r '.[].commit.committer.name' | tail -n 1) + echo $(curl -sSL $commit_url | jq -r '.[].commit.committer.email' | tail -n 1) + git config user.name $(curl -sSL $commit_url | jq -r '.[].commit.committer.name' | tail -n 1) + git config user.email $(curl -sSL $commit_url | jq -r '.[].commit.committer.email' | tail -n 1) git commit --allow-empty -m "${GITHUB_CONTEXT}" - git push origin wasmtime-performance-testing/FB/${{ github.ref_name }}/${{ github.sha }} + git push origin wasmtime-performance-testing/${{ github.ref }}/${{ github.sha }} #curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{ env.TOKEN }}" https://api.github.com/repos/bytecodealliance/wasmtime-sightglass-benchmarking/dispatches -d '{"event_type":"Performance Testing", "client_payload":{"message":"${{ env.MESSAGE }}", "actor":"${{ env.ACTOR }}", "repository":"${{ env.REPOSITORY }}", "ref":"${{ env.REFS }}", "pr_number":"${{ env.PR_NUMBER }}", "publish":"${{ env.PUBLISH }}" }' Performance_Repo_On_Push: