Repository navigation
ci(dispatch): skip retro for scaffold PRs #8057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,6 +119,7 @@ jobs: | |
| TRIGGERING_LABEL: ${{ github.event.label.name }} | ||
| PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }} | ||
| PR_BASE_REPO: ${{ github.event.pull_request.base.repo.full_name }} | ||
| PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} | ||
| PR_USER_LOGIN: ${{ github.event.pull_request.user.login }} | ||
| ORG_NAME: ${{ github.repository_owner }} | ||
| GH_TOKEN: ${{ github.token }} | ||
|
|
@@ -284,7 +285,14 @@ jobs: | |
| closed) | ||
| # Intentional ungated: any closer may trigger read-only retro | ||
| # (lifecycle accounting). See ADR 0054 #5223 note. | ||
| STAGE="retro" | ||
| case "${PR_HEAD_REF}" in | ||
| fullsend/onboard|fullsend/offboard|fullsend/scaffold-install) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [medium] protected-path This PR modifies a protected infrastructure file: .github/workflows/reusable-dispatch.yml. Issue #8043 and the PR description explain the scaffold-retro suppression, but protected-path changes always require human approval, regardless of context. Suggested fix: Obtain a human maintainer's approval of the workflow routing change. |
||
| echo "::notice::Skipping retro for fullsend scaffold PR on ${PR_HEAD_REF}" | ||
|
Comment on lines
+288
to
+290
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Unrelated pull requests skip retros The closed route decides whether to suppress retro using only PR_HEAD_REF, without verifying that the pull request is a scaffold PR. If a contributor closes a substantive PR from a fork branch named fullsend/onboard or fullsend/offboard, the caller forwards the event but the route emits no stage, so the automatic retro never runs. Agent Prompt
|
||
| ;; | ||
| *) | ||
| STAGE="retro" | ||
| ;; | ||
| esac | ||
| ;; | ||
| esac | ||
| ;; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| package scaffold | ||
|
|
||
| import ( | ||
| "os" | ||
| "os/exec" | ||
| "path/filepath" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
| "gopkg.in/yaml.v3" | ||
| ) | ||
|
|
||
| // TestReusableDispatchSkipsRetroForScaffoldBranches executes the actual route | ||
| // script, so the branch guard cannot drift from the workflow's behaviour. | ||
| func TestReusableDispatchSkipsRetroForScaffoldBranches(t *testing.T) { | ||
| if _, err := exec.LookPath("bash"); err != nil { | ||
| t.Skip("bash not available") | ||
| } | ||
|
|
||
| content, err := os.ReadFile(filepath.Join("..", "..", ".github", "workflows", "reusable-dispatch.yml")) | ||
| require.NoError(t, err) | ||
|
|
||
| var workflow struct { | ||
| Jobs struct { | ||
| Route struct { | ||
| Steps []struct { | ||
| Name string `yaml:"name"` | ||
| Run string `yaml:"run"` | ||
| } `yaml:"steps"` | ||
| } `yaml:"route"` | ||
| } `yaml:"jobs"` | ||
| } | ||
| require.NoError(t, yaml.Unmarshal(content, &workflow)) | ||
|
|
||
| var script string | ||
| for _, step := range workflow.Jobs.Route.Steps { | ||
| if step.Name == "Determine stage" { | ||
| script = step.Run | ||
| break | ||
| } | ||
| } | ||
| require.NotEmpty(t, script, "route job must retain its Determine stage script") | ||
|
|
||
| runRoute := func(t *testing.T, branch string) string { | ||
| t.Helper() | ||
| dir := t.TempDir() | ||
| scriptPath := filepath.Join(dir, "route.sh") | ||
| outputPath := filepath.Join(dir, "output") | ||
| require.NoError(t, os.WriteFile(scriptPath, []byte(script), 0o644)) | ||
|
|
||
| cmd := exec.Command("bash", scriptPath) | ||
| cmd.Env = append(os.Environ(), | ||
| "EVENT_NAME=pull_request_target", | ||
| "EVENT_ACTION=closed", | ||
| "PR_HEAD_REF="+branch, | ||
| "GITHUB_OUTPUT="+outputPath, | ||
| ) | ||
| out, err := cmd.CombinedOutput() | ||
| require.NoError(t, err, "route script must exit cleanly: %s", out) | ||
|
|
||
| result, err := os.ReadFile(outputPath) | ||
| require.NoError(t, err) | ||
| return string(result) | ||
| } | ||
|
|
||
| for _, branch := range []string{ | ||
| "fullsend/onboard", | ||
| "fullsend/offboard", | ||
| "fullsend/scaffold-install", | ||
| } { | ||
| t.Run(branch, func(t *testing.T) { | ||
| require.Equal(t, "stage=\n", runRoute(t, branch)) | ||
| }) | ||
| } | ||
|
|
||
| t.Run("ordinary branch still routes to retro", func(t *testing.T) { | ||
| require.Equal(t, "stage=retro\ntrigger_source=\n", runRoute(t, "fix/8043")) | ||
| }) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Per-org scaffold prs still run retros
📘 Rule violation⚙ MaintainabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation toolsDismiss ↗ | View ↗