Skip to content

Commit fdd5c7c

Browse files
Copilotth3w1zard1Boden
authored
ci(defender): fix Bandit path-length error on Windows by enabling LongPathsEnabled (#211)
Co-authored-by: th3w1zard1 <2219836+th3w1zard1@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Boden <halomastar@gmail.com>
1 parent db366cf commit fdd5c7c

1 file changed

Lines changed: 3 additions & 25 deletions

File tree

.github/workflows/defender-for-devops.yml

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,12 @@ jobs:
4747
dotnet-version: |
4848
5.0.x
4949
6.0.x
50-
- name: Shorten workspace and temp paths on Windows
50+
- name: Enable long paths on Windows
5151
if: runner.os == 'Windows'
5252
shell: pwsh
5353
run: |
54-
New-Item -ItemType Directory -Force -Path C:\msdo-temp | Out-Null
55-
subst W: "$env:GITHUB_WORKSPACE"
56-
"GITHUB_WORKSPACE=W:\" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
57-
"RUNNER_TEMP=C:\msdo-temp" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
58-
"TMP=C:\msdo-temp" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
59-
"TEMP=C:\msdo-temp" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
60-
- name: Shorten workspace and temp paths on Linux
61-
if: runner.os == 'Linux'
62-
shell: bash
63-
run: |
64-
mkdir -p /tmp/msdo
65-
ln -sfn "$GITHUB_WORKSPACE" /tmp/msdo/workspace
66-
{
67-
echo "GITHUB_WORKSPACE=/tmp/msdo/workspace"
68-
echo "RUNNER_TEMP=/tmp/msdo"
69-
echo "TMPDIR=/tmp/msdo"
70-
echo "TMP=/tmp/msdo"
71-
echo "TEMP=/tmp/msdo"
72-
} >> "$GITHUB_ENV"
54+
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1
55+
git config --system core.longpaths true
7356
- name: Run Microsoft Security DevOps
7457
uses: microsoft/security-devops-action@v1.12.0
7558
id: msdo
@@ -78,8 +61,3 @@ jobs:
7861
with:
7962
sarif_file: ${{ steps.msdo.outputs.sarifFile }}
8063
category: msdo-${{ matrix.os }}
81-
- name: Remove Windows short path mapping
82-
if: always() && runner.os == 'Windows'
83-
shell: pwsh
84-
run: |
85-
subst W: /d

0 commit comments

Comments
 (0)