You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SDK-7461] fix(setup-env): deliver BUILD_RUN_IDENTIFIER, ask the API when the actor is unknown, stop failing silently
Three changes to the BrowserStack re-run delivery path.
1. BROWSERSTACK_BUILD_RUN_IDENTIFIER has been dropped since 2026-05-07.
The rebuild/details response carries three variables; the APS-19076 allowlist
(8ade0a3) listed only two plus BUILD_NAME, so the identifier is filtered out and
only a core.warning marks it. Verified against the live API. The SDKs send it as
build_run_identifier in the build-start payload, which files a re-run as an
attempt of its parent build rather than an unrelated build. PR #85's own body
predicted this: "If the rerun API legitimately sets additional names in
production, the list will need to grow."
2. An unreported GITHUB_TRIGGERING_ACTOR no longer aborts delivery.
That variable comes from the runner binary, so a self-hosted runner can simply
not set it. The actor check is only a cheap pre-filter — rebuild/details is the
authority and returns no variables when BrowserStack did not trigger the re-run.
Bailing on an absent actor turned a working re-run into a full-suite run on an
otherwise correctly configured workflow. We now warn and ask the API instead.
3. Every remaining delivery failure names itself.
With github-token at its 'none' default the job log was byte-identical to a
healthy run, and the CLI then runs the full spec set because
BROWSERSTACK_RERUN_TESTS is absent — so "all my tests ran again" was
undiagnosable. checkIfBStackReRun now names the missing input, a human-triggered
re-run says so, and an API failure is a warning rather than info. Attempt 1 stays
silent: an ordinary run is not a degraded re-run.
Verified end-to-end through the built dist into the real CLI across all eight
delivery states, and reproduced against a real reported failure: the build ran
11 sessions, the targeted spec folder holds 11 specs, and the real CLI dispatches
11 with the list absent and 3 with it present.
47 tests passing (4 new), eslint clean, dist rebuilt with ncc (reproducible).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
// Past this point GitHub re-ran the workflow, so the failed-test list was meant to be
34675
+
// delivered. Every bail below silently degrades the re-run into a full-suite run, which
34676
+
// is indistinguishable from correct behaviour unless we say so here (SDK-7461).
34677
+
const missing = [];
34678
+
if (!this.githubToken || this.githubToken === 'none') missing.push("the 'github-token' input");
34679
+
if (!this.runId) missing.push('GITHUB_RUN_ID');
34680
+
if (!this.repository || this.repository === 'none') missing.push('GITHUB_REPOSITORY');
34681
+
if (!this.username) missing.push("the 'username' input");
34682
+
if (!this.accessKey) missing.push("the 'access-key' input");
34683
+
34684
+
if (missing.length) {
34685
+
core.warning(`This is re-run attempt ${this.rerunAttempt}, but BrowserStack cannot deliver the failed-test list because ${missing.join(', ')} ${missing.length > 1 ? 'are' : 'is'} not set. Every test will run again instead of only the failed ones. Pass github-token to this action to enable re-running only failed tests.`);
// The actor check is only a cheap pre-filter; the rebuild/details endpoint is the
34692
+
// authority on whether BrowserStack triggered this re-run, and it returns no variables
34693
+
// when it did not. GITHUB_TRIGGERING_ACTOR comes from the runner binary, so a
34694
+
// self-hosted runner can simply not set it — bailing there would turn a working re-run
34695
+
// into a full-suite run on an otherwise correct setup (SDK-7461). Ask the API instead.
34696
+
if (!triggeringActor) {
34697
+
core.warning(`This is re-run attempt ${this.rerunAttempt} and the runner did not report GITHUB_TRIGGERING_ACTOR, so BrowserStack cannot pre-confirm that it triggered this re-run — asking BrowserStack directly instead. This variable is set by the runner itself; on a self-hosted runner, updating the runner restores the faster check.`);
34698
+
return true;
34699
+
}
34700
+
34676
34701
core.info(`Triggering actor is - ${triggeringActor}`);
34677
-
return triggeringActor === this.githubApp;
34702
+
if (triggeringActor !== this.githubApp) {
34703
+
core.info(`This re-run was started by '${triggeringActor}', not by the BrowserStack GitHub App ('${this.githubApp}'), so there is no failed-test list to apply and every test will run again. Re-runs started from the BrowserStack dashboard run only the failed tests; check that the BrowserStack GitHub App is installed on ${this.repository}.`);
core.warning(`This is re-run attempt ${this.rerunAttempt}, but BrowserStack cannot deliver the failed-test list because ${missing.join(', ')}${missing.length>1 ? 'are' : 'is'} not set. Every test will run again instead of only the failed ones. Pass github-token to this action to enable re-running only failed tests.`);
// The actor check is only a cheap pre-filter; the rebuild/details endpoint is the
120
+
// authority on whether BrowserStack triggered this re-run, and it returns no variables
121
+
// when it did not. GITHUB_TRIGGERING_ACTOR comes from the runner binary, so a
122
+
// self-hosted runner can simply not set it — bailing there would turn a working re-run
123
+
// into a full-suite run on an otherwise correct setup (SDK-7461). Ask the API instead.
124
+
if(!triggeringActor){
125
+
core.warning(`This is re-run attempt ${this.rerunAttempt} and the runner did not report GITHUB_TRIGGERING_ACTOR, so BrowserStack cannot pre-confirm that it triggered this re-run — asking BrowserStack directly instead. This variable is set by the runner itself; on a self-hosted runner, updating the runner restores the faster check.`);
126
+
returntrue;
127
+
}
128
+
109
129
core.info(`Triggering actor is - ${triggeringActor}`);
110
-
returntriggeringActor===this.githubApp;
130
+
if(triggeringActor!==this.githubApp){
131
+
core.info(`This re-run was started by '${triggeringActor}', not by the BrowserStack GitHub App ('${this.githubApp}'), so there is no failed-test list to apply and every test will run again. Re-runs started from the BrowserStack dashboard run only the failed tests; check that the BrowserStack GitHub App is installed on ${this.repository}.`);
0 commit comments