From a34e9d0c246dbc71affcfbd84c2cd8585dc7d3ee Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Thu, 31 Oct 2024 16:44:25 +0000 Subject: [PATCH] gha - don't stop if Pipefile.lock is modified, but add a warning about it This is because it should not break the tests suite, but still is something to deal with --- .../workflows/actions/quarto-dev/action.yml | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/actions/quarto-dev/action.yml b/.github/workflows/actions/quarto-dev/action.yml index 9254780a6d..b28d3e7351 100644 --- a/.github/workflows/actions/quarto-dev/action.yml +++ b/.github/workflows/actions/quarto-dev/action.yml @@ -42,10 +42,28 @@ runs: echo "Unexpected package/dist/share path detected: $(quarto --paths)" Exit 1 } - If ( "$(git status --porcelain)" -ne "" ) { - echo "Uncommitted changes detected:" - git status --porcelain - Exit 1 + # check if configure is modifying some files as it should not + $modifiedFiles = git diff --name-only + If ($modifiedFiles -ne "") { + + # Convert the list to an array + $modifiedFilesArray = $modifiedFiles -split "`n" | ForEach-Object { $_.Trim() } + + If ($modifiedFilesArray -contains "tests/Pipfile.lock") { + Write-Output "::warning::test/Pipfile.lock has been modified." + $modifiedFilesArray = $modifiedFilesArray | Where-Object { $_ -notmatch "Pipfile.lock" } + } + + # Count the number of modified files + $modifiedFilesCount = $modifiedFilesArray.Count + + If ($modifiedFilesCount -ge 1) { + Write-Output "::error::Uncommitted changes detected." + foreach ($file in $modifiedFilesArray) { + Write-Output $file + } + Exit 1 + } } - name: Quarto Check