From 871be8f54ace198c42780b366d1817ffc77e9fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sat, 8 Mar 2025 12:46:24 +0100 Subject: [PATCH 1/2] Add missing `GH_TOKEN` environment variable It is needed for using the `gh` CLI commands. --- .github/workflows/post-merge.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/post-merge.yml b/.github/workflows/post-merge.yml index d3f42c5a9052c..919e1bb33206f 100644 --- a/.github/workflows/post-merge.yml +++ b/.github/workflows/post-merge.yml @@ -17,14 +17,15 @@ jobs: steps: - uses: actions/checkout@v4 - name: Perform analysis and send PR + env: + GH_TOKEN: ${{ github.token }} run: | # Get closest bors merge commit PARENT_COMMIT=`git rev-list --author='bors ' -n1 --first-parent HEAD^1` + echo "Parent: ${PARENT_COMMIT}" # Find PR for the current commit HEAD_PR=`gh pr list --search "${{ github.sha }}" --state merged --json number --jq '.[0].number'` - - echo "Parent: ${PARENT_COMMIT}" echo "HEAD: ${{ github.sha }} (#${HEAD_PR})" cd src/ci/citool From ff674232d198b196c8fa9d2092b8165b4bcce6b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sat, 8 Mar 2025 12:46:33 +0100 Subject: [PATCH 2/2] Fix checkout in post-merge workflow --- .github/workflows/post-merge.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/post-merge.yml b/.github/workflows/post-merge.yml index 919e1bb33206f..2bc06d83c5b7c 100644 --- a/.github/workflows/post-merge.yml +++ b/.github/workflows/post-merge.yml @@ -16,6 +16,11 @@ jobs: pull-requests: write steps: - uses: actions/checkout@v4 + with: + # Make sure that we have enough commits to find the parent merge commit. + # Since all merges should be through merge commits, fetching two commits + # should be enough to get the parent bors merge commit. + fetch-depth: 2 - name: Perform analysis and send PR env: GH_TOKEN: ${{ github.token }}