Skip to content

Conversation

@daniel-richter
Copy link
Contributor

@daniel-richter daniel-richter commented Jul 25, 2025

Right now, the AI-assisted actions don’t actually know anything about the file system during a workflow run. They just talk directly to the GitHub REST API to grab whatever they need from the repo. So, you don’t need to use actions/checkout, and even if you do, the action won’t look at the files on disk (at least for now).

Have the action look for the files locally first, and only fall back to grabbing them from the repo blobs if it can’t find them.


This change enhances the context file retrieval functionality by adding a fallback mechanism that reads files directly from the runner's filesystem when the GitHub API method is unavailable or insufficient. The implementation adds filesystem-based file discovery alongside the existing GitHub API approach, providing more reliable access to context files during PR analysis.

Walkthrough

  • New Feature: Added filesystem-based context file reading as a fallback to GitHub API retrieval, improving reliability when accessing repository files for AI analysis
  • Refactor: Enhanced logging by clarifying the distinction between GitHub API and filesystem methods for context file retrieval
  • Chore: Added necessary Node.js filesystem and path module imports to support the new file reading functionality

Model: anthropic--claude-4-sonnet | Prompt Tokens: 1336 | Completion Tokens: 151

@github-actions
Copy link

Added logic to pull configured context files directly from the runner’s workspace in addition to the GitHub API, enabling more comprehensive PR reviews and summaries. Log grouping labels have been updated to clearly separate API and filesystem sources.

Walkthrough

  • New Feature: Fetch context files from the runner’s local filesystem using include/exclude patterns
  • New Feature: Push file contents into the review/summary prompt to enrich AI output
  • Bug Fix: Differentiate log groups for “GitHub API” vs “runner’s filesystem” sources
  • Chore: Import fs and path modules and adjust group labels for clarity

Model: o4-mini | Prompt Tokens: 1093 | Completion Tokens: 468

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for sharing your code. AI offers friendly suggestions to enhance your work, but these are optional ideas based on patterns, not absolute rules. Use what resonates with your style and goals. You remain in control; AI is here simply to support your creative journey.
Model: o4-mini | Prompt Tokens: 1811 | Completion Tokens: 2772

Comment on lines +119 to +120
if (config.includeContextFiles.some(pattern => minimatch(filePath, pattern, matchOptions))) {
if (config.excludeContextFiles.some(pattern => minimatch(filePath, pattern, matchOptions))) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling minimatch against each pattern in every iteration can become expensive for large file sets. Precompile your glob patterns into Minimatch instances or create predicate functions once before the loop. For example:

const includeMatchers = config.includeContextFiles.map(p => new Minimatch(p, matchOptions));
const excludeMatchers = config.excludeContextFiles.map(p => new Minimatch(p, matchOptions));

for await (const filePath of walk(process.cwd())) {
  if (includeMatchers.some(m => m.match(filePath)) && !excludeMatchers.some(m => m.match(filePath))) {
    // ...
  }
}

@daniel-richter daniel-richter marked this pull request as ready for review July 25, 2025 15:30
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a supportive code review enhanced by AI assistance. These observations offer helpful suggestions and insights, though some are AI-generated predictions rather than definitive conclusions. Please consider what feels most useful for your project. You remain the expert and decision-maker—AI simply provides additional perspective to support your development process.
Model: anthropic--claude-4-sonnet | Prompt Tokens: 2091 | Completion Tokens: 1700

@daniel-richter daniel-richter merged commit f7d34a1 into main Jul 25, 2025
15 checks passed
@daniel-richter daniel-richter deleted the context-file-from-disk branch July 25, 2025 15:32
github-actions bot pushed a commit that referenced this pull request Jul 25, 2025
* Add functionality to read context files from the runner's filesystem

* Add functionality to read context files from the runner's filesystem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants