SIGN IN SIGN UP

Simplify BCApps e2e scenario to verify CI/CD and PR Build success (#2306)

### ❔What, Why & How

Rework the BCApps e2e scenario to limit the build to the `Apps *`
projects, reuse the push-triggered CI/CD run, and verify both CI/CD and
PR builds conclude successfully with the expected artifacts — plus a
couple of supporting e2e-infra fixes.

**`e2eTests/scenarios/BCApps/runtest.ps1`**
- Pushing the `projects` settings change to `main` already triggers a
full CI/CD build; the scenario reuses that push-triggered run (returned
by `Add-PropertiesToJsonFile -commit -wait`) instead of dispatching a
second, redundant `RunCICD` run.
- Both the CI/CD and Pull Request Build runs are re-fetched after
waiting and explicitly asserted to conclude with `success` —
`WaitWorkflow` tolerates `cancelled`, so a cancelled run no longer
passes. `WaitWorkflow`'s global behavior is left unchanged.
- The re-fetch after `WaitWorkflow` now calls `RefreshToken` and
rebuilds the headers from the refreshed `$ENV:GH_TOKEN`. `WaitWorkflow`
can outlive the 10-minute GitHub App token window, so the previous stale
headers could 401 on a long-running build.
- Retained app/test-app artifact validation for both builds. The
selected `Apps *` projects define `testFolders` (compiled into
`.buildartifacts/TestApps` and published as `*-TestApps-*`), so
`Test-ArtifactsFromRun` + `*-Apps-*`/`*-TestApps-*` count assertions
confirm the builds produced useful output.

**`.github/workflows/E2E.yaml`**
- Fixed scenario filtering: `$scenariosFilter | ForEach-Object {
$scenario -like $_ }` returned an array of booleans (always truthy) and
did not filter. Now uses `@(... | Where-Object { $scenario -like $_
}).Count -gt 0`, with results wrapped in `@()` to guarantee arrays.

**`e2eTests/e2eTestHelper.psm1`**
- Pass `-silent` to the initial `invoke-git add` / `invoke-git commit`
in `CreateAlGoRepository` to suppress excessive git output during repo
initialization.

### ✅ Checklist

- [x] Add tests (E2E, unit tests) — updates the BCApps E2E scenario,
test run: https://github.com/microsoft/AL-Go/actions/runs/29086533488

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Maria Zhelezova <43066499+mazhelez@users.noreply.github.com>
C
Copilot committed
16948d91ca57e875e3d823536bac740c0ca1fdbd
Parent: 93bb835
Committed by GitHub <noreply@github.com> on 7/13/2026, 9:05:41 AM