Repository navigation
Read workflows from GitHub's default branch, not checkout - #23
Merged
Merged
Conversation
…tcher is off The startup audit read .github/workflows from whatever was checked out locally. GitHub runs the default branch, so a stale clone or another branch could hide a merged GH_RUNNER_* fallback: gh-runner offered a fix that was already merged and registered a runner with the refusal watcher quietly off. - Scan the default branch through the contents API. Fall back to the checkout only when GitHub can't be read, and warn that it may not match. The audit no longer needs a checkout at all. - When the watcher is off, say so. When no job can reach the runner and nothing reads its variable, warn that it will sit idle. - A fix PR blocks a new one only while it's open, and only once the default branch is known to still need the fix. A merged PR's leftover branch no longer stops anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011jzs3cPY8d3Le9V5W22Dyd
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.
Summary
This change makes
gh-runneraudit workflows against the default branch on GitHub (via the API) rather than relying on the local checkout. This ensures the audit reflects what GitHub will actually run, not a potentially stale or out-of-sync local copy.Key Changes
Workflow source abstraction: Introduced
WorkflowSourceinterface to support reading workflows from either a checkout or GitHub API, with implementationscheckoutWorkflows()andgithubWorkflows()GitHub API methods: Added
GhClientmethods to read workflows from GitHub:workflowFileNames()- lists workflow files on a branchworkflowFile()- reads a single workflow file raw and untrimmedopenPullRequestWithPrefix()- finds open PRs by branch prefixAudit refactoring: New
auditWorkflows()function that:Fix branch logic: Simplified
proposeWorkflowFix()to:Improved reporting: Enhanced workflow audit output to:
Test coverage: Added comprehensive tests for:
Notable Implementation Details
https://claude.ai/code/session_011jzs3cPY8d3Le9V5W22Dyd