浏览代码

ci(e2e): extract branch name from github.ref instead of github.head_ref

Nicolas Meienberger 2 年之前
父节点
当前提交
4eaf2c00c3
共有 1 个文件被更改,包括 9 次插入3 次删除
  1. 9 3
      .github/workflows/e2e.yml

+ 9 - 3
.github/workflows/e2e.yml

@@ -93,16 +93,22 @@ jobs:
       - name: Wait 1 minute for Droplet to be ready
       - name: Wait 1 minute for Droplet to be ready
         run: sleep 60
         run: sleep 60
 
 
+      - name: Extract branch name from ref
+        id: extract-branch-name
+        run: |
+          branch_name=$(echo ${{ github.ref }} | sed 's/refs\/heads\///')
+          echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
+
       - name: Deploy app to Droplet
       - name: Deploy app to Droplet
         uses: fifsky/ssh-action@master
         uses: fifsky/ssh-action@master
         with:
         with:
           command: |
           command: |
             echo 'Cloning repo on branch ${{ github.head_ref }}'
             echo 'Cloning repo on branch ${{ github.head_ref }}'
-            git clone --single-branch --branch ${{ github.head_ref }} https://github.com/${{ github.repository }}
+            git clone --single-branch --branch ${{ steps.extract-branch-name.outputs.branch_name }} https://github.com/${{ github.repository }}
             echo 'Waiting for dpkg lock to be released'
             echo 'Waiting for dpkg lock to be released'
             cd runtipi
             cd runtipi
-            echo 'Checking out branch ${{ github.head_ref }}'
-            git checkout ${{ github.head_ref }}
+            echo 'Checking out branch ${{ steps.extract-branch-name.outputs.branch_name }}'
+            git checkout ${{ steps.extract-branch-name.outputs.branch_name }}
             sudo ./scripts/start-e2e.sh e2e
             sudo ./scripts/start-e2e.sh e2e
             echo 'App deployed'
             echo 'App deployed'
           host: ${{ steps.get-droplet-ip.outputs.droplet_ip }}
           host: ${{ steps.get-droplet-ip.outputs.droplet_ip }}