From 3bf519de38ba3b7e7f2bdac2544ae0b3f2321450 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 27 Nov 2024 10:45:53 +0100 Subject: [PATCH] ci: compliance: Rebase on the target branch before running compliance Prior to running the compliance checks, we rebase the PR onto the target branch to check the compliance state as if we were merged. Signed-off-by: Pieter De Gendt --- .github/workflows/compliance.yml | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml index d1961ace8b5..ecd874dd486 100644 --- a/.github/workflows/compliance.yml +++ b/.github/workflows/compliance.yml @@ -23,6 +23,21 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 + - name: Rebase onto the target branch + env: + BASE_REF: ${{ github.base_ref }} + run: | + git config --global user.email "you@example.com" + git config --global user.name "Your Name" + git remote -v + # Ensure there's no merge commits in the PR + [[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ + (echo "::error ::Merge commits not allowed, rebase instead";false) + git rebase origin/${BASE_REF} + git clean -f -d + # debug + git log --pretty=oneline | head -n 10 + - name: Set up Python uses: actions/setup-python@v5 with: @@ -42,19 +57,7 @@ jobs: pip3 install west - name: west setup - env: - BASE_REF: ${{ github.base_ref }} run: | - git config --global user.email "you@example.com" - git config --global user.name "Your Name" - git remote -v - # Ensure there's no merge commits in the PR - [[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ - (echo "::error ::Merge commits not allowed, rebase instead";false) - git rebase origin/${BASE_REF} - git clean -f -d - # debug - git log --pretty=oneline | head -n 10 west init -l . || true west config manifest.group-filter -- +ci,-optional west update -o=--depth=1 -n 2>&1 1> west.update.log || west update -o=--depth=1 -n 2>&1 1> west.update2.log