Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create the rebase action #959

Merged
merged 5 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/actions/rebase/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 'Rebase'
description: 'Action for rebasing to the main branch'

runs:
using: 'composite'
steps:

# Setup identity to avoid errors when git is trying to rebase without identity set
- name: Setup git identity
run: |
git config --global user.email "[email protected]"
git config --global user.name "Rebase Action"
shell: bash

# Update origin/main branch locally to cover case when repo is not fully cloned
# for example when using `actions/checkout@v4` action with default `fetch-depth` value (1)
# read more: https://github.com/actions/checkout?tab=readme-ov-file#usage
- name: Update origin/main
run: |
git fetch origin main
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
3 changes: 1 addition & 2 deletions .github/workflows/gitleaks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/integration-tests-pull.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,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 test
Expand All @@ -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/create-single-cluster
- name: run test
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,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:
Expand All @@ -23,6 +24,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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/markdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,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
Expand All @@ -20,6 +21,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
Expand Down
Loading