From 8506d6f524ecd9b49c4e578f92d0c65c8fce3ea2 Mon Sep 17 00:00:00 2001 From: Wentao Wu Date: Thu, 27 Jun 2024 15:17:42 +0800 Subject: [PATCH] checkout --- .github/workflows/build.yml | 56 ++++++++++++------------------------- 1 file changed, 18 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 528f861..f45c503 100755 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,44 +42,6 @@ jobs: image_md5: ${{ steps.save_tftp.outputs.image_md5 }} image_path: ${{ steps.save_tftp.outputs.image_path }} steps: - - name: Install node for action/checkout - id: install_node - run: | - set -x - PR_REPO=${{ github.event.pull_request.head.repo.full_name }} - PR_BRANCH=${{ github.event.pull_request.head.ref }} - BASE_REPO=${{ github.repository }} - BASE_BRANCH=${{ github.event.pull_request.base.ref }} - echo "PR_REPO: ${PR_REPO}, PR_BRANCH: ${PR_BRANCH}" - echo "BASE_REPO: ${BASE_REPO}, BASE_BRANCH: ${BASE_BRANCH}" - # cache from https://nodejs.org/en/download/prebuilt-binaries - pwd - whoami - ls -alht - sudo wget -q https://ai.b-bug.org/k230/test_resources/ci/packages/node-v20.15.0-linux-x64.tar.xz || exit 1 - ls -alht - sudo mkdir /opt/node/ || exit 1 - sudo tar -xf node-v20.15.0-linux-x64.tar.xz --strip-components=1 -C /opt/node/ || exit 1 - sudo chmod -R 755 /opt/node || exit 1 - ls /opt/node/bin/ - echo "show version with path" - /opt/node/bin/node --version - sudo ln -s /opt/node/bin/node /opt/node/bin/node20 - export NODEJS_HOME=/opt/node/bin - export PATH=$NODEJS_HOME:$PATH - echo "confirm version without path" - node --version || exit 1 - npm --version - which node - which npm - set +x - - - name: Checkout Source Code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - clean: true - - name: Build Env Setup id: build_env run: | @@ -108,6 +70,24 @@ jobs: HW_MODEL=$(echo $CONF | awk -F "_" '{if ($3 == "v2") print $2"_"$3; else print $2}') echo "HW_TYPE ${HW_TYPE}, HW_MODEL ${HW_MODEL}" + - name: Checkout Code + id: checkout_code + run: | + set -x + PR_REPO=${{ github.event.pull_request.head.repo.full_name }} + PR_BRANCH=${{ github.event.pull_request.head.ref }} + BASE_REPO=${{ github.repository }} + BASE_BRANCH=${{ github.event.pull_request.base.ref }} + echo "PR_REPO: ${PR_REPO}, PR_BRANCH: ${PR_BRANCH}" + echo "BASE_REPO: ${BASE_REPO}, BASE_BRANCH: ${BASE_BRANCH}" + echo "Cloning PR repository ${PR_REPO} branch ${PR_BRANCH}" + git clone --depth=0 --branch=${PR_BRANCH} https://github.com/${PR_REPO} /workspace || git clone --depth=0 --branch=${PR_BRANCH} https://github.com/${PR_REPO} /workspace + cd /workspace + git fetch origin ${PR_BRANCH}:${PR_BRANCH} || exit 1 + git checkout ${PR_BRANCH} || exit 1 + ls -alht + pwd + - name: Build Image id: build_image run: |