From d7a996c686867db87bf4514d6747d48323119003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 31 Aug 2023 15:34:16 +0200 Subject: [PATCH 1/2] gha: Update to checkout@v3 action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At this point we should always be using the latest checkout action. Signed-off-by: Fabiano FidĂȘncio --- .github/workflows/add-issues-to-project.yaml | 2 +- .github/workflows/add-pr-sizing-label.yaml | 2 +- .github/workflows/darwin-tests.yaml | 2 +- .github/workflows/docs-url-alive-check.yaml | 2 +- .github/workflows/move-issues-to-in-progress.yaml | 2 +- .github/workflows/require-pr-porting-labels.yaml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/add-issues-to-project.yaml b/.github/workflows/add-issues-to-project.yaml index 117e62600..6ba266261 100644 --- a/.github/workflows/add-issues-to-project.yaml +++ b/.github/workflows/add-issues-to-project.yaml @@ -39,7 +39,7 @@ jobs: popd &>/dev/null - name: Checkout code to allow hub to communicate with the project - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Add issue to issue backlog env: diff --git a/.github/workflows/add-pr-sizing-label.yaml b/.github/workflows/add-pr-sizing-label.yaml index 313c9f285..b8d498363 100644 --- a/.github/workflows/add-pr-sizing-label.yaml +++ b/.github/workflows/add-pr-sizing-label.yaml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v1 + uses: actions/checkout@v3 - name: Install PR sizing label script run: | diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml index 02bbb0e72..8b3f9041a 100644 --- a/.github/workflows/darwin-tests.yaml +++ b/.github/workflows/darwin-tests.yaml @@ -21,6 +21,6 @@ jobs: with: go-version: 1.19.3 - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Build utils run: ./ci/darwin-test.sh diff --git a/.github/workflows/docs-url-alive-check.yaml b/.github/workflows/docs-url-alive-check.yaml index bd1f5ab2c..543215f77 100644 --- a/.github/workflows/docs-url-alive-check.yaml +++ b/.github/workflows/docs-url-alive-check.yaml @@ -22,7 +22,7 @@ jobs: echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV echo "${{ github.workspace }}/bin" >> $GITHUB_PATH - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 path: ./src/github.com/${{ github.repository }} diff --git a/.github/workflows/move-issues-to-in-progress.yaml b/.github/workflows/move-issues-to-in-progress.yaml index 0e15abaea..64a453d64 100644 --- a/.github/workflows/move-issues-to-in-progress.yaml +++ b/.github/workflows/move-issues-to-in-progress.yaml @@ -38,7 +38,7 @@ jobs: - name: Checkout code to allow hub to communicate with the project if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Move issue to "In progress" if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} diff --git a/.github/workflows/require-pr-porting-labels.yaml b/.github/workflows/require-pr-porting-labels.yaml index b16e5c371..ea3016b5a 100644 --- a/.github/workflows/require-pr-porting-labels.yaml +++ b/.github/workflows/require-pr-porting-labels.yaml @@ -36,7 +36,7 @@ jobs: - name: Checkout code to allow hub to communicate with the project if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install porting checker script run: | From ac939c458cde2286f15b0fa3bbf43a3aae7778d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Fri, 1 Sep 2023 11:23:31 +0200 Subject: [PATCH 2/2] gha: Rebase atop of the target branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have two scenarios we care about this, `pull_request` and `pull_request_target` events triggered a job. `pull_request` event: When using the checkout action, it'll already provide a "rebased atop of main" repo for us, nothing else is needed, and that's basically what we already have as part of the jobs in our CI. `pull_request_target` event: This one is a little bit tricky, as the checkout action, unless passing a spsecific repo, give us the PR checked out rebased atop of the HEAD of the PR branch. Jeremi Piotrowski nicely pointed out that we could use github.event.pull_request.merge_commit_sha instead, which is the result of the PR's branch with the official repo target branch. Now, the only cases where the contributor's rebase would still be needed is when the action itself has been changed. Fixes: #7414 Signed-off-by: Fabiano FidĂȘncio --- .github/workflows/add-pr-sizing-label.yaml | 2 ++ .github/workflows/ci-on-push.yaml | 2 +- .github/workflows/move-issues-to-in-progress.yaml | 2 ++ .github/workflows/require-pr-porting-labels.yaml | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/add-pr-sizing-label.yaml b/.github/workflows/add-pr-sizing-label.yaml index b8d498363..b972616fa 100644 --- a/.github/workflows/add-pr-sizing-label.yaml +++ b/.github/workflows/add-pr-sizing-label.yaml @@ -22,6 +22,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.merge_commit_sha }} - name: Install PR sizing label script run: | diff --git a/.github/workflows/ci-on-push.yaml b/.github/workflows/ci-on-push.yaml index e1f3eaf96..f37f1b91c 100644 --- a/.github/workflows/ci-on-push.yaml +++ b/.github/workflows/ci-on-push.yaml @@ -25,7 +25,7 @@ jobs: if: ${{ contains(github.event.pull_request.labels.*.name, 'ok-to-test') }} uses: ./.github/workflows/ci.yaml with: - commit-hash: ${{ github.event.pull_request.head.sha }} + commit-hash: ${{ github.event.pull_request.merge_commit_sha }} pr-number: ${{ github.event.pull_request.number }} tag: ${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} secrets: inherit diff --git a/.github/workflows/move-issues-to-in-progress.yaml b/.github/workflows/move-issues-to-in-progress.yaml index 64a453d64..2c4c3d2c8 100644 --- a/.github/workflows/move-issues-to-in-progress.yaml +++ b/.github/workflows/move-issues-to-in-progress.yaml @@ -39,6 +39,8 @@ jobs: - name: Checkout code to allow hub to communicate with the project if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.merge_commit_sha }} - name: Move issue to "In progress" if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} diff --git a/.github/workflows/require-pr-porting-labels.yaml b/.github/workflows/require-pr-porting-labels.yaml index ea3016b5a..a06bbbf96 100644 --- a/.github/workflows/require-pr-porting-labels.yaml +++ b/.github/workflows/require-pr-porting-labels.yaml @@ -37,6 +37,8 @@ jobs: - name: Checkout code to allow hub to communicate with the project if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.merge_commit_sha }} - name: Install porting checker script run: |