Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 31, 2025

Campaign workflows were failing with path validation errors because files were being nested under a subdirectory matching the branch name instead of being placed at the branch root.

Error: File does not match allowed patterns: memory/campaigns/go-file-size-reduction-project64/metrics/2025-12-31.json
Error: Allowed patterns: go-file-size-reduction-project64/**

Changes

actions/setup/js/push_repo_memory.cjs

  • Remove nested directory creation when copying files to checked-out branch
  • Files now placed at branch root instead of ${workspaceDir}/${branchName}/
- const destMemoryPath = path.join(workspaceDir, branchName);
- fs.mkdirSync(destMemoryPath, { recursive: true });
+ const destMemoryPath = workspaceDir;

Impact

Before: Branch memory/campaigns contained memory/campaigns/go-file-size-reduction-project64/...
After: Branch memory/campaigns contains go-file-size-reduction-project64/...

Glob patterns now match correctly against relative paths from the artifact root, fixing validation failures in all workflows using branch-based repo-memory.

Original prompt

See campaign run: https://github.com/githubnext/gh-aw/actions/runs/20618086805/job/59214719890
Fix error by comparing relative paths as the pattern expects:
Error: File does not match allowed patterns: memory/campaigns/go-file-size-reduction-project64/metrics/2025-12-31.json
Error: Allowed patterns: go-file-size-reduction-project64/**


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

The issue was that files were being copied to a subdirectory matching the
branch name (e.g., memory/campaigns/) inside the checked-out branch, creating
nested structure. This caused file pattern validation to fail because the
relative paths included the branch name prefix.

The fix removes the creation of this subdirectory - files are now copied
directly to the root of the checked-out branch, which is the correct behavior.

Files in branch "memory/campaigns" are now at:
  - go-file-size-reduction-project64/metrics/2025-12-31.json
Instead of:
  - memory/campaigns/go-file-size-reduction-project64/metrics/2025-12-31.json

This allows the glob pattern "go-file-size-reduction-project64/**" to match
correctly against the relative file paths.

Co-authored-by: mnkiefer <[email protected]>
Copilot AI changed the title [WIP] Fix error by comparing relative paths as expected Fix repo-memory path validation: remove branch name nesting Dec 31, 2025
Copilot AI requested a review from mnkiefer December 31, 2025 11:50
@mnkiefer mnkiefer marked this pull request as ready for review December 31, 2025 11:52
@mnkiefer mnkiefer merged commit 957f63e into main Dec 31, 2025
170 checks passed
@mnkiefer mnkiefer deleted the copilot/fix-file-pattern-error branch December 31, 2025 12:05
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