From a81480d9016fce5be628ef08b51e255c1bcd0a1f Mon Sep 17 00:00:00 2001
From: Joris Vaillant <joris.vaillant@inria.fr>
Date: Wed, 16 Oct 2024 09:42:29 +0200
Subject: [PATCH] ci: Revert change on linux.yml

---
 .github/workflows/linux.yml | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index c9f21fea27..4cdcc70aae 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -44,19 +44,9 @@ jobs:
       - name: Setup Container
         run: |
           apt update && DEBIAN_FRONTEND="noninteractive" apt install -y sudo lsb-release gnupg2 cmake git python3
-
-      # extract branch name or checkout devel branch for scheduled events
-      - name: Get branch name or checkout devel
-        run: |
-          if [ "${{ github.event_name }}" == "schedule" ]; then
-            echo "BRANCH_NAME=devel" >> $GITHUB_ENV
-          else
-            echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
-          fi
-
       - uses: actions/checkout@v4
         with:
-          ref: ${{ env.BRANCH_NAME }}
+          fetch-depth: 0
           submodules: recursive
 
       - name: Setup ccache
@@ -67,6 +57,18 @@ jobs:
           key: ccache-linux-${{ matrix.container }}-${{ github.sha }}
           restore-keys: ccache-linux-${{ matrix.container }}-
 
+    # extract branch name
+      - name: Get branch name (merge)
+        if: github.event_name != 'pull_request'
+        shell: bash
+        run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
+
+    # extract branch name on pull request
+      - name: Get branch name (pull request)
+        if: github.event_name == 'pull_request'
+        shell: bash
+        run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV
+
     # print branch name
       - name: Debug
         run: echo ${{ env.BRANCH_NAME }}