From 586d2480b39ae7922ad29dfe519c4389299c185f Mon Sep 17 00:00:00 2001 From: Wen Zhou Date: Mon, 16 May 2022 16:29:50 +0200 Subject: [PATCH] fix: GH action checkout bug (#2924) * fix: Config git to fix issue with checkout action with safe.directory and disable shellcheck - https://github.com/actions/checkout/issues/760 - feat: disable SC on GH action workflows - SC2006:style:2:21: Use $(...) notation instead of legacy backticks `...` - SC2086:info:2:48: Double quote to prevent globbing and word splitting * fix: remove SC disble but add .github/workflows into FILTER_REGEX_EXCLUDE - dont think .github/linters/.jscpd.json works * fix: linter * Revert "fix: remove SC disble but add .github/workflows into" This reverts commit 3545f3f0823992000f55d1185337dc4a8b5ab63c. * fix: more linter * fix: change to use linux path than windows path in ubuntu container * fix: upgrade to v3 fixed is in v3.0.2 - https://github.com/actions/checkout/blob/2541b1294d2704b0964813337f33b291d3f8596b/CHANGELOG.md#v302 * fix: trying with a solution for cygwin - ref: https://github.com/actions/checkout/issues/767 - ref2: https://github.com/me-and/Cygwin-Git/actions/runs/2307847122/workflow * fix: Config git to fix issue with checkout action with safe.directory and disable shellcheck - https://github.com/actions/checkout/issues/760 - feat: disable SC on GH action workflows - SC2006:style:2:21: Use $(...) notation instead of legacy backticks `...` - SC2086:info:2:48: Double quote to prevent globbing and word splitting * fix: remove SC disble but add .github/workflows into FILTER_REGEX_EXCLUDE - dont think .github/linters/.jscpd.json works * fix: linter * Revert "fix: remove SC disble but add .github/workflows into" This reverts commit 3545f3f0823992000f55d1185337dc4a8b5ab63c. * fix: more linter * fix: change to use linux path than windows path in ubuntu container * fix: upgrade to v3 fixed is in v3.0.2 - https://github.com/actions/checkout/blob/2541b1294d2704b0964813337f33b291d3f8596b/CHANGELOG.md#v302 * fix: trying with a solution for cygwin - ref: https://github.com/actions/checkout/issues/767 - ref2: https://github.com/me-and/Cygwin-Git/actions/runs/2307847122/workflow * fix: syntax for pwsh * fix: mark run to use pwsh --- .github/workflows/build.yml | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5086875c9..6989a0807 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,8 +81,8 @@ jobs: tar -xf "${GITHUB_WORKSPACE}/workspace/target/OpenJDK.tar.gz" -C "${HOME}/JDK" - name: Set root of jdk image dir run: | - imageroot=`find ${HOME}/JDK -name release -type f` - echo "TEST_JDK_HOME=`dirname ${imageroot}`" >> $GITHUB_ENV + imageroot=$(find "${HOME}/JDK" -name release -type f) + echo "TEST_JDK_HOME=$(dirname "${imageroot}")" >> "$GITHUB_ENV" - name: Smoke test uses: adoptium/run-aqa@v1 with: @@ -158,8 +158,8 @@ jobs: - name: Set root of jdk image dir run: | - imageroot=`find ${HOME}/JDK -name release -type f` - echo "TEST_JDK_HOME=`dirname ${imageroot}`" >> $GITHUB_ENV + imageroot=$(find "${HOME}/JDK" -name release -type f) + echo "TEST_JDK_HOME=$(dirname "${imageroot}")" >> "$GITHUB_ENV" - name: Smoke test uses: adoptium/run-aqa@v1 with: @@ -216,7 +216,7 @@ jobs: Start-Process -Wait -FilePath 'C:\temp\git.exe' -ArgumentList '/SILENT /ALLOWDOWNGRADE=1** /COMPONENTS="icons,ext\reg\shellhere,assoc,assoc_sh"' - name: Set PATH - run: echo "C:\cygwin64\bin;C:\Program Files\Git\bin;" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + run: echo "C:\cygwin64\bin;C:\Program Files\Git\bin;" | Out-File -FilePath "$env:GITHUB_PATH" -Encoding utf8 -Append - name: Install Visual Studio 2013 run: | @@ -225,18 +225,20 @@ jobs: - name: Cygwin git configuration shell: bash - run: mkdir $HOME && git config --system core.autocrlf false + run: mkdir "$HOME" && git config --system core.autocrlf false && git config --global --add safe.directory '*' - - uses: actions/checkout@v2 + - uses: actions/checkout@v3.0.2 + with: + set-safe-directory: false - name: Setup 8dot3name run: fsutil behavior set disable8dot3 0 - name: Set JAVA_HOME - run: echo "JAVA_HOME=$(cygpath ${{ steps.setup-java11.outputs.path }})" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + run: echo "JAVA_HOME=$(cygpath "${{ steps.setup-java11.outputs.path }}")" | Out-File -FilePath "$env:GITHUB_ENV" -Encoding utf8 -Append - name: Set JDK7_BOOT_DIR - run: echo "JDK7_BOOT_DIR=$(cygpath ${{ steps.setup-java7.outputs.path }})" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + run: echo "JDK7_BOOT_DIR=$(cygpath "${{ steps.setup-java7.outputs.path }}")" | Out-File -FilePath "$env:GITHUB_ENV" -Encoding utf8 -Append if: matrix.version == 'jdk8u' - name: Build Windows @@ -261,14 +263,16 @@ jobs: with: name: ${{matrix.version}}-${{matrix.os}}-${{matrix.vm}} path: ~/${{matrix.version}}-${{matrix.os}}-${{matrix.vm}} + - name: Unpack jdk run: | unzip "${HOME}/${{matrix.version}}-${{matrix.os}}-${{matrix.vm}}/OpenJDK.zip" -d "${HOME}/${{matrix.version}}-${{matrix.os}}-${{matrix.vm}}" - name: Set root of jdk image dir + shell: pwsh run: | - $imageroot = find ${HOME}/${{matrix.version}}-${{matrix.os}}-${{matrix.vm}} -name release -type f - echo "TEST_JDK_HOME=$(dirname ${imageroot})" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + $imageroot=$(find "${HOME}/${{matrix.version}}-${{matrix.os}}-${{matrix.vm}}" -name release -type f) + echo "TEST_JDK_HOME=$(dirname "${imageroot}")" | Out-File -FilePath "$env:GITHUB_ENV" -Encoding utf8 -Append - name: Smoke test uses: adoptium/run-aqa@v1 with: