Skip to content

[plan] Add no-op early exit guard to Hourly CI Cleaner #7413

@github-actions

Description

@github-actions

Objective

Add an early exit mechanism to the Hourly CI Cleaner workflow that skips execution when there is no work to do, preventing unnecessary token consumption.

Context

The Copilot Token Report (discussion #7407) recommends adding a no-op exit guard to the Hourly CI Cleaner. This will prevent the workflow from consuming tokens when there are no CI runs to clean up.

Approach

  1. Add a preliminary step that checks if there are CI runs to clean
  2. Use GitHub API to query for qualifying runs
  3. If no runs found, exit early with success status
  4. Document the no-op behavior in workflow comments

Implementation Strategy

Add an early check before the main Copilot agent execution:

steps:
  - name: Check for CI runs to clean
    id: check
    run: |
      # Query for qualifying CI runs
      count=$(gh api ... | jq 'length')
      echo "count=$count" >> $GITHUB_OUTPUT
      
  - name: Run CI Cleaner
    if: steps.check.outputs.count > 0
    # ... existing Copilot agent execution

Files to Modify

  • Hourly CI Cleaner workflow file (identified in previous issue)

Acceptance Criteria

  • Workflow checks for work before executing
  • Early exit occurs when no CI runs need cleaning
  • Token consumption drops for no-op runs
  • Workflow still cleans CI runs when work exists
  • Logs clearly indicate no-op vs. execution runs

Expected Impact

AI generated by Plan Command for discussion #7407

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions