diff --git a/.github/actions/rebase/action.yaml b/.github/actions/rebase/action.yaml new file mode 100644 index 000000000..14738eeb3 --- /dev/null +++ b/.github/actions/rebase/action.yaml @@ -0,0 +1,24 @@ +name: 'Rebase' +description: 'Action for rebasing to the main branch' + +runs: + using: 'composite' + steps: + + - name: Update origin/main + run: | + git checkout --track origin/main + git pull --unshallow origin main + + git switch --detach - + shell: bash + + - name: Rebase to main + run: | + git rebase main + shell: bash + + - name: Print branch log + run: | + git log origin/main~1.. + shell: bash diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 1f24e49c1..29af2aa5a 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -18,6 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: ./.github/actions/rebase - uses: ./.github/actions/setup-go - uses: golangci/golangci-lint-action@v3 with: @@ -28,6 +29,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: ./.github/actions/rebase - uses: ./.github/actions/setup-go - uses: ./.github/actions/setup-libgit2 - uses: golangci/golangci-lint-action@v3 diff --git a/.github/workflows/markdown.yaml b/.github/workflows/markdown.yaml index 532131405..7fc6bf2aa 100644 --- a/.github/workflows/markdown.yaml +++ b/.github/workflows/markdown.yaml @@ -9,6 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: ./.github/actions/rebase - uses: gaurav-nelson/github-action-markdown-link-check@v1 with: use-quiet-mode: 'yes' diff --git a/.github/workflows/operator-verify.yaml b/.github/workflows/operator-verify.yaml index d95096883..0decc0711 100644 --- a/.github/workflows/operator-verify.yaml +++ b/.github/workflows/operator-verify.yaml @@ -20,6 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: ./.github/actions/rebase - uses: ./.github/actions/setup-go - name: run test run: make -C components/operator test @@ -29,6 +30,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: ./.github/actions/rebase - uses: ./.github/actions/setup-go - uses: ./.github/actions/create-single-cluster - name: run integration test (pre) diff --git a/.github/workflows/pull-gitleaks.yaml b/.github/workflows/pull-gitleaks.yaml index baecdfa4f..49c6b89c7 100644 --- a/.github/workflows/pull-gitleaks.yaml +++ b/.github/workflows/pull-gitleaks.yaml @@ -11,8 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - uses: ./.github/actions/rebase - name: Fetch gitleaks ${{ env.GITLEAKS_VERSION }} run: curl -Lso gitleaks.tar.gz https://github.com/gitleaks/gitleaks/releases/download/v${{ env.GITLEAKS_VERSION }}/gitleaks_${{ env.GITLEAKS_VERSION }}_linux_x64.tar.gz && tar -xvzf ./gitleaks.tar.gz - name: Run gitleaks diff --git a/.github/workflows/serverless-verify.yaml b/.github/workflows/serverless-verify.yaml index b736c095d..bcf9580c8 100644 --- a/.github/workflows/serverless-verify.yaml +++ b/.github/workflows/serverless-verify.yaml @@ -20,6 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: ./.github/actions/rebase - uses: ./.github/actions/setup-go - uses: ./.github/actions/setup-libgit2 - name: run test @@ -30,6 +31,7 @@ jobs: if: github.event.pull_request.draft == false steps: - uses: actions/checkout@v4 + - uses: ./.github/actions/rebase - uses: ./.github/actions/setup-go - uses: ./.github/actions/create-single-cluster - name: run integration test (pre)