Skip to content

fix(compliance): remove dev-lead workflow manipulation from re-trigger sweep (Step 1 is out of scope) #438

Description

@don-petry

Summary

The daily re-trigger sweep (scripts/compliance-retrigger.sh) does more than re-trigger stale issues: Step 1 (check_devlead_workflows) inspects every fleet repo's dev-lead.yml and silently re-enables it if it finds the workflow disabled_manually or disabled_inactivity. This is out of scope for a re-trigger sweep and should be removed.

Evidence

scripts/compliance-retrigger.sh (on main):

  • check_devlead_workflows() — defined at line 92; called from main() at line 359.
  • It enables workflows via the API at line 116:
    gh api -X PUT "repos/$ORG/$repo/actions/workflows/$wf_id/enable"
  • The summary even reports it: Workflows re-enabled: ${WORKFLOWS_DISABLED} (lines 132, 332, 345).

The job declares permissions: contents: read (.github/workflows/compliance-retrigger.yml:31) but performs this mutation through the ORG_SCORECARD_TOKEN PAT, bypassing the workflow's stated least-privilege boundary.

Why this is invalid

  1. Separation of concerns. A "re-trigger stale issues" sweep should re-fire issues:labeled events — nothing more. Mutating the enablement state of another workflow is a different responsibility with a different owner.
  2. Overrides deliberate intent. If a maintainer disables dev-lead in a repo on purpose (incident response, a noisy/looping agent, a repo being wound down), the next daily sweep silently turns it back on within 24h — an unwanted, surprising side effect.
  3. Least-privilege violation. The job advertises contents: read but performs actions: write-class mutations via a PAT. The visible permission contract understates what the job actually does.
  4. Hidden cross-repo writes. A governance sweep quietly changing config across the whole fleet is hard to audit and easy to forget exists.

Recommended Actions

  1. Remove check_devlead_workflows() and its call site from scripts/compliance-retrigger.sh, along with the WORKFLOWS_DISABLED / WORKFLOWS_ENABLED counters and their summary lines (console + step summary).
  2. Keep the sweep focused solely on Step 2 (re-trigger stale issues, one engagement per repo per run).
  3. If "dev-lead must stay enabled fleet-wide" is a real requirement, move that enforcement to a dedicated, clearly-named workflow (e.g. dev-lead-workflow-health) that:
    • declares the permission it actually needs,
    • logs/justifies each enable as its own auditable action,
    • and ideally reports a disabled workflow rather than auto-overriding a maintainer's deliberate disable.
  4. Update the script header docstring (the "What it does" section) to drop Step 1.

Acceptance Criteria

  • compliance-retrigger.sh no longer reads or modifies any repo's dev-lead.yml enablement state.
  • The sweep's behaviour is unchanged for issue re-triggering.
  • Dry-run output and step summary no longer mention "workflows re-enabled".

Context

Identified while documenting the daily sweep (follow-up to #431 / PR #432). Part of the Compliance program initiative (GH Project #1 Initiatives).

Metadata

Metadata

Assignees

No one assigned

    Labels

    automationAutomation improvements and gapsbugBug reportsciCI/CD pipeline issuesdev-leadFor dev-lead agent pickup

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions