From 8b31a37ec97e1ac2133102f78140d2974791365e Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Tue, 11 Jun 2024 14:45:14 -0400 Subject: [PATCH 1/3] .github: only fetch the base branch when rebasing Update the "check commits" action to only fetch the base branch that we will be rebasing on. Otherwise every upstream branch is fetched. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a9217f5555..b56df02af1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -105,7 +105,7 @@ jobs: - name: fetch and rebase on ${{ github.base_ref }} run: | git remote add upstream https://github.com/${{ github.repository }} - git fetch upstream + git fetch upstream ${{ github.base_ref }}:refs/remotes/upstream/${{ github.base_ref }} export GIT_COMMITTER_EMAIL="lnd-ci@example.com" export GIT_COMMITTER_NAME="LND CI" git rebase upstream/${{ github.base_ref }} From 20be40df7beeeb495e8434926a0ae51753b0bd1b Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Tue, 11 Jun 2024 14:47:19 -0400 Subject: [PATCH 2/3] .github: make the rebase step re-usable --- .github/actions/rebase/action.yml | 15 +++++++++++++++ .github/workflows/main.yml | 7 +------ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 .github/actions/rebase/action.yml diff --git a/.github/actions/rebase/action.yml b/.github/actions/rebase/action.yml new file mode 100644 index 0000000000..cf2e72f341 --- /dev/null +++ b/.github/actions/rebase/action.yml @@ -0,0 +1,15 @@ +name: "Rebase on to the PR target base branch" +description: "A reusable workflow that's used to rebase the PR code on to the target base branch." + +runs: + using: "composite" + + steps: + - name: fetch and rebase on ${{ github.base_ref }} + shell: bash + run: | + git remote add upstream https://github.com/${{ github.repository }} + git fetch upstream ${{ github.base_ref }}:refs/remotes/upstream/${{ github.base_ref }} + export GIT_COMMITTER_EMAIL="lnd-ci@example.com" + export GIT_COMMITTER_NAME="LND CI" + git rebase upstream/${{ github.base_ref }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b56df02af1..2b953d756d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -103,12 +103,7 @@ jobs: go-version: '${{ env.GO_VERSION }}' - name: fetch and rebase on ${{ github.base_ref }} - run: | - git remote add upstream https://github.com/${{ github.repository }} - git fetch upstream ${{ github.base_ref }}:refs/remotes/upstream/${{ github.base_ref }} - export GIT_COMMITTER_EMAIL="lnd-ci@example.com" - export GIT_COMMITTER_NAME="LND CI" - git rebase upstream/${{ github.base_ref }} + uses: ./.github/actions/rebase - name: check commits run: scripts/check-each-commit.sh upstream/${{ github.base_ref }} From e326e242ffdc469d5675ba3198c9ef25653bb171 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Tue, 11 Jun 2024 14:49:09 -0400 Subject: [PATCH 3/3] .github: rebase before running itests & unit tests --- .github/workflows/main.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2b953d756d..7a5038455b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -195,6 +195,12 @@ jobs: steps: - name: git checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: fetch and rebase on ${{ github.base_ref }} + if: github.event_name == 'pull_request' + uses: ./.github/actions/rebase - name: git checkout fuzzing seeds uses: actions/checkout@v3 @@ -261,6 +267,12 @@ jobs: steps: - name: git checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: fetch and rebase on ${{ github.base_ref }} + if: github.event_name == 'pull_request' + uses: ./.github/actions/rebase - name: setup go ${{ env.GO_VERSION }} uses: ./.github/actions/setup-go @@ -306,6 +318,12 @@ jobs: steps: - name: git checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: fetch and rebase on ${{ github.base_ref }} + if: github.event_name == 'pull_request' + uses: ./.github/actions/rebase - name: setup go ${{ env.GO_VERSION }} uses: ./.github/actions/setup-go @@ -344,6 +362,12 @@ jobs: steps: - name: git checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: fetch and rebase on ${{ github.base_ref }} + if: github.event_name == 'pull_request' + uses: ./.github/actions/rebase - name: setup go ${{ env.GO_VERSION }} uses: ./.github/actions/setup-go