@@ -246,15 +246,15 @@ Assert-Pass "collect-audit-evidence parses hosted JSON on Windows PowerShell 5.1
246246 $env: GITHUB_OPTIMIZATION_DISABLE_CURL_FALLBACK = " 1"
247247 $out = & (Join-Path $Shelf " scripts\collect-audit-evidence.ps1" ) - RepoPath $tempRepo - HostedRepo " example/compat" 2>&1 | Out-String
248248 if ($LASTEXITCODE -ne 0 ) { throw " expected exit 0, got $LASTEXITCODE `n $out " }
249- foreach ($needle in @ (
250- ' "description":"fixture repo"' ,
251- ' "result":"ABSENT"," requested":".github/ISSUE_TEMPLATE/bug_report.md"' ,
252- ' "result":"ABSENT"," requested":".github/ISSUE_TEMPLATE/feature_request.md"' ,
253- ' "result":"ABSENT"," requested":".github/ISSUE_TEMPLATE/config.yml"' ,
254- " result: NO_RUNS (workflow files exist but the GitHub Actions runs API returned 0 runs)"
249+ foreach ($pattern in @ (
250+ [ regex ]::Escape( ' "description":"fixture repo"' ) ,
251+ ' (?s)\{(?=.*" requested":"\ .github/ISSUE_TEMPLATE/bug_report\ .md")(?=.*"result":"ABSENT").*\} ' ,
252+ ' (?s)\{(?=.*" requested":"\ .github/ISSUE_TEMPLATE/feature_request\ .md")(?=.*"result":"ABSENT").*\} ' ,
253+ ' (?s)\{(?=.*" requested":"\ .github/ISSUE_TEMPLATE/config\ .yml")(?=.*"result":"ABSENT").*\} ' ,
254+ [ regex ]::Escape( " result: NO_RUNS (workflow files exist but the GitHub Actions runs API returned 0 runs)" )
255255 )) {
256- if ($out -notmatch [ regex ]::Escape( $needle ) ) {
257- throw " missing output: $needle `n $out "
256+ if ($out -notmatch $pattern ) {
257+ throw " missing output pattern : $pattern `n $out "
258258 }
259259 }
260260 if ($out -match " ConvertFrom-Json : A parameter cannot be found that matches parameter name 'Depth'" ) {
@@ -465,13 +465,13 @@ Assert-Pass "collect-audit-evidence preserves caller GH_CONFIG_DIR for public gh
465465 $env: GH_CONFIG_DIR = $expectedGhConfigDir
466466 $out = & (Join-Path $Shelf " scripts\collect-audit-evidence.ps1" ) - RepoPath $tempRepo - HostedRepo " example/gh-config" 2>&1 | Out-String
467467 if ($LASTEXITCODE -ne 0 ) { throw " expected exit 0, got $LASTEXITCODE `n $out " }
468- foreach ($needle in @ (
469- ( ' "description":"' + $expectedGhConfigDir + ' "' ),
470- ' "result":"ABSENT"," requested":".github/ISSUE_TEMPLATE/bug_report.md"' ,
471- " result: NOT_CONFIGURED (no local GitHub Actions workflow files detected and the runs API returned 0 runs)"
468+ foreach ($pattern in @ (
469+ [ regex ]::Escape(( ' "description":"' + $expectedGhConfigDir + ' "' ) ),
470+ ' (?s)\{(?=.*" requested":"\ .github/ISSUE_TEMPLATE/bug_report\ .md")(?=.*"result":"ABSENT").*\} ' ,
471+ [ regex ]::Escape( " result: NOT_CONFIGURED (no local GitHub Actions workflow files detected and the runs API returned 0 runs)" )
472472 )) {
473- if ($out -notmatch [ regex ]::Escape( $needle ) ) {
474- throw " missing output: $needle `n $out "
473+ if ($out -notmatch $pattern ) {
474+ throw " missing output pattern : $pattern `n $out "
475475 }
476476 }
477477 if ($env: GH_CONFIG_DIR -ne $expectedGhConfigDir ) {
@@ -548,13 +548,13 @@ Assert-Pass "collect-audit-evidence retries public gh api with isolated GH_CONFI
548548 Remove-Item Env:GH_CONFIG_DIR - ErrorAction SilentlyContinue
549549 $out = & (Join-Path $Shelf " scripts\collect-audit-evidence.ps1" ) - RepoPath $tempRepo - HostedRepo " example/gh-config-retry" 2>&1 | Out-String
550550 if ($LASTEXITCODE -ne 0 ) { throw " expected exit 0, got $LASTEXITCODE `n $out " }
551- foreach ($needle in @ (
552- ' "description":"retry-ok"' ,
553- ' "result":"ABSENT"," requested":".github/ISSUE_TEMPLATE/bug_report.md"' ,
554- ' result: NOT_CONFIGURED (no local GitHub Actions workflow files detected and the runs API returned 0 runs)'
551+ foreach ($pattern in @ (
552+ [ regex ]::Escape( ' "description":"retry-ok"' ) ,
553+ ' (?s)\{(?=.*" requested":"\ .github/ISSUE_TEMPLATE/bug_report\ .md")(?=.*"result":"ABSENT").*\} ' ,
554+ [ regex ]::Escape( ' result: NOT_CONFIGURED (no local GitHub Actions workflow files detected and the runs API returned 0 runs)' )
555555 )) {
556- if ($out -notmatch [ regex ]::Escape( $needle ) ) {
557- throw " missing output: $needle `n $out "
556+ if ($out -notmatch $pattern ) {
557+ throw " missing output pattern : $pattern `n $out "
558558 }
559559 }
560560 if ($out -match ' API_BLOCKED' ) {
@@ -618,16 +618,16 @@ Assert-Pass "collect-audit-evidence does not treat gh auth-required retry failur
618618 Remove-Item Env:GH_CONFIG_DIR - ErrorAction SilentlyContinue
619619 $out = & (Join-Path $Shelf " scripts\collect-audit-evidence.ps1" ) - RepoPath $tempRepo - HostedRepo " example/gh-auth-required" 2>&1 | Out-String
620620 if ($LASTEXITCODE -ne 1 ) { throw " expected exit 1, got $LASTEXITCODE `n $out " }
621- foreach ($needle in @ (
622- ' result: BLOCKED (API_BLOCKED: hosted metadata unavailable)' ,
623- ' "result":"API_BLOCKED"," requested":".github/ISSUE_TEMPLATE/bug_report.md"' ,
624- ' "result":"API_BLOCKED"," requested":".github/ISSUE_TEMPLATE/feature_request.md"' ,
625- ' "result":"API_BLOCKED"," requested":".github/ISSUE_TEMPLATE/config.yml"' ,
626- ' result: BLOCKED (API_BLOCKED: hosted issue-template lookup unavailable)' ,
627- ' result: BLOCKED (API_BLOCKED: latest CI metadata unavailable)'
621+ foreach ($pattern in @ (
622+ [ regex ]::Escape( ' result: BLOCKED (API_BLOCKED: hosted metadata unavailable)' ) ,
623+ ' (?s)\{(?=.*" requested":"\ .github/ISSUE_TEMPLATE/bug_report\ .md")(?=.*"result":"API_BLOCKED").*\} ' ,
624+ ' (?s)\{(?=.*" requested":"\ .github/ISSUE_TEMPLATE/feature_request\ .md")(?=.*"result":"API_BLOCKED").*\} ' ,
625+ ' (?s)\{(?=.*" requested":"\ .github/ISSUE_TEMPLATE/config\ .yml")(?=.*"result":"API_BLOCKED").*\} ' ,
626+ [ regex ]::Escape( ' result: BLOCKED (API_BLOCKED: hosted issue-template lookup unavailable)' ) ,
627+ [ regex ]::Escape( ' result: BLOCKED (API_BLOCKED: latest CI metadata unavailable)' )
628628 )) {
629- if ($out -notmatch [ regex ]::Escape( $needle ) ) {
630- throw " missing output: $needle `n $out "
629+ if ($out -notmatch $pattern ) {
630+ throw " missing output pattern : $pattern `n $out "
631631 }
632632 }
633633 if ($out -match ' "result":"ABSENT","requested":".github/ISSUE_TEMPLATE/' ) {
@@ -694,14 +694,14 @@ Assert-Pass "collect-audit-evidence records API_BLOCKED when hosted issue templa
694694 $env: GITHUB_OPTIMIZATION_DISABLE_CURL_FALLBACK = " 1"
695695 $out = & (Join-Path $Shelf " scripts\collect-audit-evidence.ps1" ) - RepoPath $tempRepo - HostedRepo " example/issue-api-blocked" 2>&1 | Out-String
696696 if ($LASTEXITCODE -ne 1 ) { throw " expected exit 1, got $LASTEXITCODE `n $out " }
697- foreach ($needle in @ (
698- ' "result":"API_BLOCKED"," requested":".github/ISSUE_TEMPLATE/bug_report.md"' ,
699- ' "result":"API_BLOCKED"," requested":".github/ISSUE_TEMPLATE/feature_request.md"' ,
700- ' "result":"API_BLOCKED"," requested":".github/ISSUE_TEMPLATE/config.yml"' ,
701- " result: BLOCKED (API_BLOCKED: hosted issue-template lookup unavailable)"
697+ foreach ($pattern in @ (
698+ ' (?s)\{(?=.*" requested":"\ .github/ISSUE_TEMPLATE/bug_report\ .md")(?=.*"result":"API_BLOCKED").*\} ' ,
699+ ' (?s)\{(?=.*" requested":"\ .github/ISSUE_TEMPLATE/feature_request\ .md")(?=.*"result":"API_BLOCKED").*\} ' ,
700+ ' (?s)\{(?=.*" requested":"\ .github/ISSUE_TEMPLATE/config\ .yml")(?=.*"result":"API_BLOCKED").*\} ' ,
701+ [ regex ]::Escape( " result: BLOCKED (API_BLOCKED: hosted issue-template lookup unavailable)" )
702702 )) {
703- if ($out -notmatch [ regex ]::Escape( $needle ) ) {
704- throw " missing output: $needle `n $out "
703+ if ($out -notmatch $pattern ) {
704+ throw " missing output pattern : $pattern `n $out "
705705 }
706706 }
707707 } finally {
@@ -840,14 +840,14 @@ Assert-Pass "collect-audit-evidence treats gh 404 issue-template responses as ab
840840 $env: GITHUB_OPTIMIZATION_DISABLE_CURL_FALLBACK = " 1"
841841 $out = & (Join-Path $Shelf " scripts\collect-audit-evidence.ps1" ) - RepoPath $fixture - HostedRepo " example/repo" 2>&1 | Out-String
842842 if ($LASTEXITCODE -ne 0 ) { throw " expected exit 0, got $LASTEXITCODE `n $out " }
843- foreach ($needle in @ (
844- ' "result":"ABSENT"," requested":".github/ISSUE_TEMPLATE/bug_report.md"' ,
845- ' "result":"ABSENT"," requested":".github/ISSUE_TEMPLATE/feature_request.md"' ,
846- ' "result":"ABSENT"," requested":".github/ISSUE_TEMPLATE/config.yml"' ,
847- ' result: NOT_CONFIGURED (no local GitHub Actions workflow files detected and the runs API returned 0 runs)'
843+ foreach ($pattern in @ (
844+ ' (?s)\{(?=.*" requested":"\ .github/ISSUE_TEMPLATE/bug_report\ .md")(?=.*"result":"ABSENT").*\} ' ,
845+ ' (?s)\{(?=.*" requested":"\ .github/ISSUE_TEMPLATE/feature_request\ .md")(?=.*"result":"ABSENT").*\} ' ,
846+ ' (?s)\{(?=.*" requested":"\ .github/ISSUE_TEMPLATE/config\ .yml")(?=.*"result":"ABSENT").*\} ' ,
847+ [ regex ]::Escape( ' result: NOT_CONFIGURED (no local GitHub Actions workflow files detected and the runs API returned 0 runs)' )
848848 )) {
849- if ($out -notmatch [ regex ]::Escape( $needle ) ) {
850- throw " missing output: $needle `n $out "
849+ if ($out -notmatch $pattern ) {
850+ throw " missing output pattern : $pattern `n $out "
851851 }
852852 }
853853 if ($out -match ' API_BLOCKED' ) {
0 commit comments