Workflow to scan for GitHub Copilot's memories
This repository contains a workflow that monitors configured repositories for GitHub Copilot memories and creates an issue when memories are detected. This helps maintain awareness of what information Copilot is storing about your repositories.
The Fetch Copilot Memories workflow checks configured repositories for GitHub Copilot memories and creates an issue when memories are found (runs daily at 8 AM UTC).
The workflow requires the following configuration:
Secrets:
COPILOT_MEMORY_PAT: A GitHub Personal Access Token withreposcope or fine-grained read access to the repositories you want to check. This token is used to call the GitHub Copilot API.
Variables (optional):
COPILOT_MEMORY_REPOSITORIES: List of repositories to check inowner/repoformat. Supports both newline-separated (preferred) and comma-separated formats:- Newline-separated (one repository per line):
rajbos/actions-marketplace-checks actions/checkout devops-actions/load-runner-info - Comma-separated (backward compatibility):
rajbos/actions-marketplace-checks,actions/checkout
- Newline-separated (one repository per line):
COPILOT_MEMORY_TAGGED_USER: GitHub username to mention in the issue when memories are found (e.g.,rajbos). The@symbol is optional.
The workflow runs automatically on a daily schedule at 8 AM UTC. You can also run it manually:
- Go to the Actions tab in the repository
- Select "Fetch Copilot Memories" workflow
- Click "Run workflow"
- Optionally, provide a custom list of repositories to check
- Fetches recent Copilot memories (up to 20 per repository) using the GitHub Copilot API
- Generates a summary of found memories
- If memories are found, creates an issue with:
- List of repositories with memories
- Count of memories per repository
- Sample of recent memories (first 5 per repo)
- Mention of the configured user (if set)
- Uploads results as a workflow artifact for later review
The workflow uses the following GitHub Copilot API endpoint:
GET https://api.githubcopilot.com/agents/swe/internal/memory/v0/{owner}/{repo}/recent?limit=20
This requires a Personal Access Token with appropriate repository access.
Tests for the Copilot memories functionality are located in tests/copilotMemories.Tests.ps1. To run the tests:
# Install Pester if not already installed
Install-Module -Name Pester -Force -SkipPublisherCheck
# Run the tests
Invoke-Pester -Path ./tests/copilotMemories.Tests.ps1