From 3958744ad8842919bcfc15fe71bca17fdaf4907d Mon Sep 17 00:00:00 2001 From: Filip Strozik Date: Tue, 7 May 2024 14:26:48 +0200 Subject: [PATCH] create pr-checkout action --- .github/actions/pr-checkout/action.yaml | 15 +++++++++++++++ .github/workflows/markdown.yaml | 2 +- .github/workflows/operator-verify.yaml | 6 +++--- .github/workflows/pull-gitleaks.yaml | 2 +- .github/workflows/serverless-verify.yaml | 6 +++--- 5 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 .github/actions/pr-checkout/action.yaml diff --git a/.github/actions/pr-checkout/action.yaml b/.github/actions/pr-checkout/action.yaml new file mode 100644 index 000000000..6139261a5 --- /dev/null +++ b/.github/actions/pr-checkout/action.yaml @@ -0,0 +1,15 @@ +name: 'Checkout to PR and rebase to main' +description: 'Action for checkouting to the PR branch and rebasing it to the main' + +runs: + using: 'composite' + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Rebase to main + run: | + git rebase origin/main + shell: bash \ No newline at end of file diff --git a/.github/workflows/markdown.yaml b/.github/workflows/markdown.yaml index 532131405..8b2d736cf 100644 --- a/.github/workflows/markdown.yaml +++ b/.github/workflows/markdown.yaml @@ -8,7 +8,7 @@ jobs: documentation-link-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: ./.github/actions/pr-checkout - 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 c605a20eb..5cd0991f3 100644 --- a/.github/workflows/operator-verify.yaml +++ b/.github/workflows/operator-verify.yaml @@ -19,7 +19,7 @@ jobs: if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: ./.github/actions/pr-checkout - uses: ./.github/actions/setup-go - uses: golangci/golangci-lint-action@v3 with: @@ -30,7 +30,7 @@ jobs: if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: ./.github/actions/pr-checkout - uses: ./.github/actions/setup-go - name: run test run: make -C components/operator test @@ -39,7 +39,7 @@ jobs: if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: ./.github/actions/pr-checkout - 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..e2aa87623 100644 --- a/.github/workflows/pull-gitleaks.yaml +++ b/.github/workflows/pull-gitleaks.yaml @@ -10,7 +10,7 @@ jobs: gitleaks-scan: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: ./.github/actions/pr-checkout with: fetch-depth: 0 - name: Fetch gitleaks ${{ env.GITLEAKS_VERSION }} diff --git a/.github/workflows/serverless-verify.yaml b/.github/workflows/serverless-verify.yaml index b251d1298..cd21145e8 100644 --- a/.github/workflows/serverless-verify.yaml +++ b/.github/workflows/serverless-verify.yaml @@ -19,7 +19,7 @@ jobs: if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: ./.github/actions/pr-checkout - uses: ./.github/actions/setup-go - uses: ./.github/actions/setup-libgit2 - uses: golangci/golangci-lint-action@v3 @@ -31,7 +31,7 @@ jobs: if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: ./.github/actions/pr-checkout - uses: ./.github/actions/setup-go - uses: ./.github/actions/setup-libgit2 - name: run test @@ -41,7 +41,7 @@ jobs: runs-on: ubuntu-latest if: github.event.pull_request.draft == false steps: - - uses: actions/checkout@v4 + - uses: ./.github/actions/pr-checkout - uses: ./.github/actions/setup-go - uses: ./.github/actions/create-single-cluster - name: run integration test (pre)