فهرست منبع

ci: checkout PR [skip ci]

Baptiste Augrain 1 سال پیش
والد
کامیت
0952b2f0dc
2فایلهای تغییر یافته به همراه12 افزوده شده و 21 حذف شده
  1. 7 21
      .github/workflows/stable-linux.yml
  2. 5 0
      get_repo.sh

+ 7 - 21
.github/workflows/stable-linux.yml

@@ -47,15 +47,9 @@ jobs:
         with:
           ref: ${{ env.GITHUB_BRANCH }}
 
-      - name: Checkout PR
-        env:
-          PR_ID: ${{ github.event.inputs.checkout_pr }}
-        run: |
-          git fetch origin pull/$PR_ID/head
-          git checkout FETCH_HEAD
-        if: github.event.inputs.checkout_pr != ''
-
       - name: Clone VSCode repo
+        env:
+          PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
         run: ./get_repo.sh
 
       - name: Check PR or cron
@@ -88,13 +82,9 @@ jobs:
         with:
           ref: ${{ env.GITHUB_BRANCH }}
 
-      - name: Checkout PR
-        uses: dawidd6/action-checkout-pr@v1
-        with:
-          pr: ${{ github.event.inputs.checkout_pr }}
-        if: github.event.inputs.checkout_pr != ''
-
       - name: Clone VSCode repo
+        env:
+          PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
         run: ./get_repo.sh
 
       - uses: docker/setup-qemu-action@v3
@@ -153,13 +143,9 @@ jobs:
         with:
           ref: ${{ env.GITHUB_BRANCH }}
 
-      - name: Checkout PR
-        uses: dawidd6/action-checkout-pr@v1
-        with:
-          pr: ${{ github.event.inputs.checkout_pr }}
-        if: github.event.inputs.checkout_pr != ''
-
       - name: Clone VSCode repo
+        env:
+          PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
         run: ./get_repo.sh
 
       - name: Install GH
@@ -194,7 +180,7 @@ jobs:
           name: assets
           path: ./assets/
           retention-days: 3
-        if: github.event.inputs.generate_assets == 'true'
+        if: env.SHOULD_BUILD == 'yes' && github.event.inputs.generate_assets == 'true'
 
       - name: Release
         env:

+ 5 - 0
get_repo.sh

@@ -8,6 +8,11 @@ if [[ "${CI_BUILD}" != "no" ]]; then
   git config --global --add safe.directory "/__w/$( echo "${GITHUB_REPOSITORY}" | awk '{print tolower($0)}' )"
 fi
 
+if [[ -n "${PULL_REQUEST_ID}" ]]; then
+  git fetch origin "pull/${PULL_REQUEST_ID}/head"
+  git checkout FETCH_HEAD
+fi
+
 if [[ -z "${RELEASE_VERSION}" ]]; then
   if [[ "${VSCODE_LATEST}" == "yes" ]] || [[ ! -f "${VSCODE_QUALITY}.json" ]]; then
     UPDATE_INFO=$( curl --silent --fail "https://update.code.visualstudio.com/api/update/darwin/${VSCODE_QUALITY}/0000000000000000000000000000000000000000" )