From 9c270b28d6c5363665758e462e3eb56ee74874fb Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 2 Feb 2024 10:50:47 +0100 Subject: [PATCH 1/4] action: use parenthesis --- .github/workflows/bench-diff.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bench-diff.yml b/.github/workflows/bench-diff.yml index 0c389831..de12034a 100644 --- a/.github/workflows/bench-diff.yml +++ b/.github/workflows/bench-diff.yml @@ -13,7 +13,8 @@ jobs: # Support for branches, non-forked-prs or forked-prs with a label if: | contains(github.event.pull_request.labels.*.name, 'safe-to-test') || - github.event_name != 'pull_request' || github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false + github.event_name != 'pull_request' || + (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) permissions: checks: write steps: From f48d911f8d9134f98b8d01ae748f0fad6ea46c30 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 2 Feb 2024 10:54:28 +0100 Subject: [PATCH 2/4] action: use the right sha commit --- .github/workflows/bench-diff.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bench-diff.yml b/.github/workflows/bench-diff.yml index de12034a..a28c0c3b 100644 --- a/.github/workflows/bench-diff.yml +++ b/.github/workflows/bench-diff.yml @@ -30,7 +30,7 @@ jobs: id: benchdiff with: benchdiff_version: 0.9.1 - status_sha: ${{ github.sha }} + status_sha: ${{ github.event_name != 'pull_request' && github.sha || github.event.pull_request.head.sha }} status_name: benchdiff-result status_on_degraded: neutral # See https://github.com/WillAbides/benchdiff From 45f0ed832cb3efbe5b6850a22f222deb7cb6b324 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 2 Feb 2024 10:59:41 +0100 Subject: [PATCH 3/4] checkout the right ref --- .github/workflows/bench-diff.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/bench-diff.yml b/.github/workflows/bench-diff.yml index a28c0c3b..6246d30a 100644 --- a/.github/workflows/bench-diff.yml +++ b/.github/workflows/bench-diff.yml @@ -22,6 +22,7 @@ jobs: with: fetch-depth: 0 persist-credentials: false + ref: ${{ github.event_name != 'pull_request' && github.sha || github.event.pull_request.head.sha }} - uses: actions/setup-go@v5 with: go-version-file: go.mod From 28f8f6b797df3a18abcd6a3a72bdd63a96c8c245 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 2 Feb 2024 11:03:35 +0100 Subject: [PATCH 4/4] debug --- .github/workflows/bench-diff.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/bench-diff.yml b/.github/workflows/bench-diff.yml index 6246d30a..df5647cb 100644 --- a/.github/workflows/bench-diff.yml +++ b/.github/workflows/bench-diff.yml @@ -18,6 +18,11 @@ jobs: permissions: checks: write steps: + - name: Debug event types + run: | + echo "${{ github.event_name != 'pull_request' && github.sha || github.event.pull_request.head.sha }}" + echo "github.sha=${{ github.sha }}" + echo "github.event.pull_request.head.sha=${{ github.event.pull_request.head.sha }}" - uses: actions/checkout@v4 with: fetch-depth: 0