CI: trigger BrowserStack directly on Dependabot PRs#3576
Merged
Conversation
The default GITHUB_TOKEN cannot trigger downstream workflows, so the safe_to_test label added by dependabot_auto_label.yml never started the BrowserStack run. Trigger BrowserStack directly for Dependabot PRs on opened/synchronize/reopened, keep the safe_to_test label opt-in for human PRs, and remove the now-redundant auto-label workflow.
Also gate the auto-run condition on github.actor == 'dependabot[bot]' so commits pushed to a Dependabot PR by anyone else fall back to the explicit safe_to_test opt-in instead of running automatically with secret access.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Category
Core Functionality (CI / GitHub Actions)
Feature/Issue Description
Q: Please give a brief summary of your feature/fix
A: The BrowserStack workflow never ran on Dependabot PRs even though the
safe_to_testlabel was being applied. GitHub deliberately prevents events created by the defaultGITHUB_TOKENfrom triggering other workflows (to avoid recursive loops), so the label re-add performed bydependabot_auto_label.ymlcould never start the BrowserStack run listening ontypes: [ labeled ]. This fix triggers BrowserStack directly for Dependabot PRs and removes the redundant auto-label workflow.Q: Give a technical rundown of what you have changed (if applicable)
A:
.github/workflows/github_actions.ymltypes: [ labeled ]totypes: [ opened, synchronize, reopened, labeled ]so Dependabot PRs start the workflow on their normal lifecycle events — no cross-workflow event chaining required.&& github.event.action != 'labeled'guard stops the labels Dependabot adds to its own PRs (dependencies,ruby, …) from each kicking off a redundant run, sinceopened/synchronizealready cover it. On non-label eventsgithub.event.labelis null, so the second clause is simply false.if: github.event.action == 'labeled'so it stays a no-op on Dependabot runs while preserving the re-trigger behaviour for human PRs..github/workflows/dependabot_auto_label.yml. Its only job was to addsafe_to_testviaGITHUB_TOKEN, which never triggered anything; with BrowserStack triggering directly it has no remaining function.Security note:
pull_request_targetruns in the base-repo context with secret access and the workflow checks outgithub.event.pull_request.head.sha— this is unchanged from today. Auto-running is limited todependabot[bot], a trusted first-party bot that only modifies dependency manifests. Thesafe_to_testlabel gate remains the path for any non-Dependabot/external PRs; the auto-trigger is intentionally not broadened to arbitrary contributors.Test Cases
Q: Describe your test cases, what you have covered and if there are any use cases that still need addressing.
A: Workflow YAML validated (no syntax/diagnostic issues). Behaviour to confirm on the next Dependabot PR against
master:opened/synchronize/reopenedevent starts exactly one BrowserStack run (no duplicate run from Dependabot's own label additions).safe_to_teststill triggers the run and the label is removed by the first step.safe_to_testlabel on a non-Dependabot PR does not trigger a run.The full end-to-end BrowserStack execution depends on repository secrets and can only be exercised in CI on the upstream repo.
Wiki Page
N/A — internal CI behaviour, no user-facing feature.