[TT-17304] Automated downstream testing for github-actions PRs#133
[TT-17304] Automated downstream testing for github-actions PRs#133konrad-sol wants to merge 4 commits into
Conversation
When a PR is opened or updated in this repo, automatically: - detect which action/workflow paths changed - find every tyk-analytics workflow that references those paths - create a short-lived branch in tyk-analytics with all pinned SHAs redirected to the PR's HEAD commit - inject workflow_dispatch into any affected workflow that lacks it (on the temp branch only, never permanently) - trigger those workflows via the GitHub API and wait for results - post a results table as a PR comment - delete the temp branch regardless of outcome Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This PR introduces a new GitHub Actions workflow, Files Changed Analysis
Architecture & Impact Assessment
Here is a diagram illustrating the workflow's logic: sequenceDiagram
participant PR in github-actions
participant test-downstream.yml
participant tyk-analytics repo
PR->>test-downstream.yml: PR opened/updated
activate test-downstream.yml
test-downstream.yml->>test-downstream.yml: **Job: detect**<br/>git diff vs base<br/>find changed paths
test-downstream.yml->>tyk-analytics repo: **Job: downstream**<br/>Checkout repo
activate tyk-analytics repo
test-downstream.yml->>tyk-analytics repo: Clean up old temp branch (if any)
test-downstream.yml->>tyk-analytics repo: Grep for affected workflows
test-downstream.yml->>tyk-analytics repo: Create new temp branch (ga-pr-133)
test-downstream.yml->>tyk-analytics repo: Patch workflows:<br/>- Update action SHA to PR SHA<br/>- Inject workflow_dispatch
test-downstream.yml->>tyk-analytics repo: Push temp branch
test-downstream.yml->>tyk-analytics repo: Trigger patched workflows via API
test-downstream.yml->>tyk-analytics repo: Poll for run completion
deactivate tyk-analytics repo
test-downstream.yml->>PR: Post results comment
test-downstream.yml->>tyk-analytics repo: Delete temp branch
deactivate test-downstream.yml
Scope Discovery & Context ExpansionThis workflow establishes a pattern for downstream testing that could be extended to other repositories that consume these actions. The Metadata
Powered by Visor from Probelabs Last updated: 2026-05-29T12:44:20.809Z | Triggered by: pr_updated | Commit: 4e73fc6 💡 TIP: You can chat with Visor using |
Security Issues (3)
Architecture Issues (2)
Performance Issues (2)
Powered by Visor from Probelabs Last updated: 2026-05-29T12:43:45.151Z | Triggered by: pr_updated | Commit: 4e73fc6 💡 TIP: You can chat with Visor using |
Two bugs fixed: 1. Python regex ^(on:)\s*$ failed to match 'on: # yamllint comment' (seen in s1-cns-scans.yml). Replace with ^(on:[^\n]*\n) which captures the full line including any trailing comment and appends workflow_dispatch on the very next line — tested against all four on: patterns in tyk-analytics. 2. git commit hard-failed when sed produced no diff (e.g. SHA already matched). Guard with 'git diff --cached --quiet' and set ok=false rather than erroring. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s-repo token ORG_GITHUB_TOKEN is not set in this repo. Switch to the GitHub App credentials (PROBE_APP_ID + PROBE_APP_PRIVATE_KEY) that are already used org-wide (force-merge.yaml, sbom-dev.yaml, godoc.yml, nancy.yaml, etc.) via actions/create-github-app-token. Changes: - Remove job-level GH_TOKEN env (can't reference step output at job level) - Add 'Generate cross-repo token' as first step using PROBE_APP_ID/PROBE_APP_PRIVATE_KEY - Thread app-token through: checkout token, every gh-cli step's GH_TOKEN env, and the Delete branch cleanup step - Switch github-script comment to github.token (the workflow's own token is sufficient for writing comments on a PR in the same repo) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
❌ Downstream test results —
|
| Workflow | Run | Result |
|---|---|---|
release.yml |
26637859488 | ⏱️ timed_out |
nightly-e2e-tests.yml |
26637864511 | ❌ failure |
What
Adds
.github/workflows/test-downstream.yml— a new workflow that automatically tests affectedtyk-analyticspipelines whenever a PR is opened or updated in this repo.Why
tyk-analyticspins allTykTechnologies/github-actionsreferences to specific commit SHAs. Until now there was no automated way to verify that a change to an action here would not break the downstream pipelines that consume it. Every verification had to be done manually.How it works
Example PR comment
release.ymlsuccessnightly-e2e-tests.ymlsuccessWhich workflows get triggered for which changes
.github/actions/tests/test-controllerrelease.yml,nightly-e2e-tests.yml.github/actions/tests/env-up+ othersrelease.yml,nightly-e2e-tests.yml.github/actions/checkout-prci-tests.yml,lint-swagger.yml.github/actions/gh-logs-analyserrelease.yml,ci-tests.yml, and others.github/workflows/dependency-guard.ymlrelease.yml,ci-tests.yml,k8s-api-tests.yaml,lint-swagger.yml.github/workflows/branch-suggestion.ymlintelligent-branch-recomendations.ymlNightly e2e tests are only triggered when the PR actually touches the test-related actions, keeping expensive runs proportional to the change scope.
Prerequisites
ORG_GITHUB_TOKENmust be available as a secret in this repo. The token needsreposcope onTykTechnologies/tyk-analytics(create/delete branches, trigger workflow dispatch, read run status).tyk-analytics changes
None. The temp branch approach handles everything — including the
workflow_dispatchinjection — without leaving any permanent footprint.