Fix cache-memory and repo-memory naming to use sanitized IDs#15558
Fix cache-memory and repo-memory naming to use sanitized IDs#15558
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot fix repo-memory naming as well using same name cleaning helper |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Applied the same Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
Co-authored-byrev-parse /opt/hostedtoolc--show-toplevel git conf�� user.email test@example.com /usr/bin/git ub/workflows -buildtags es/.bin/sh git` (http block)
|
There was a problem hiding this comment.
Pull request overview
This pull request fixes cache-memory and repo-memory naming to use sanitized IDs, addressing the issue where cache keys were using ${{ github.workflow }} (the workflow name with spaces and mixed casing) instead of a sanitized workflow ID. The changes ensure consistent, filesystem-safe naming across cache keys and artifact names.
Changes:
- Added
SanitizeWorkflowIDForCacheKey()helper function that removes hyphens and lowercases workflow/memory IDs - Introduced
GH_AW_WORKFLOW_ID_SANITIZEDenvironment variable in the main job to hold the sanitized workflow ID - Updated all cache-memory key expressions to use the sanitized environment variable instead of
github.workflow - Applied sanitization to repo-memory artifact names to remove hyphens
Reviewed changes
Copilot reviewed 160 out of 160 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/compiler_yaml_helpers.go |
Added SanitizeWorkflowIDForCacheKey() helper function with clear documentation |
pkg/workflow/compiler_yaml_helpers_test.go |
Added comprehensive tests for the sanitization function covering multiple edge cases |
pkg/workflow/compiler_activation_jobs.go |
Set GH_AW_WORKFLOW_ID_SANITIZED environment variable in the main job |
pkg/workflow/cache.go |
Updated cache key generation to use sanitized workflow ID throughout (default keys, custom keys, restore keys) |
pkg/workflow/repo_memory.go |
Applied sanitization to artifact upload and download names |
pkg/workflow/repo_memory_path_consistency_test.go |
Updated test expectations to reflect sanitized artifact names |
pkg/workflow/cache_memory_*.go test files |
Updated test expectations for cache keys to use sanitized IDs |
.github/workflows/*.lock.yml (150+ files) |
Regenerated lock files with new environment variable and sanitized cache keys |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Cache-memory artifact keys were using
${{ github.workflow }}(the workflow name, e.g., "Smoke Copilot") instead of the sanitized workflow ID, resulting in keys with spaces and inconsistent casing. Repo-memory artifact names could also contain hyphens if users configured memory IDs with hyphens.Changes
Cache-Memory
SanitizeWorkflowIDForCacheKey(): Removes hyphens and lowercases workflow ID (e.g.,smoke-copilot→smokecopilot)GH_AW_WORKFLOW_ID_SANITIZEDenv var: Set at main job level, contains sanitized workflow IDmemory-${{ github.workflow }}-${{ github.run_id }}tomemory-${{ env.GH_AW_WORKFLOW_ID_SANITIZED }}-${{ github.run_id }}Repo-Memory
code-metrics→codemetrics)SanitizeWorkflowIDForCacheKey()helperExamples
Cache-Memory
For workflow file
smoke-copilot.md:Repo-Memory
For a memory with ID
code-metrics:Applied to all cache key generation points in
cache.go(default keys, custom keys, restore keys, artifact uploads) and repo-memory artifact naming inrepo_memory.go.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.