#### How to use
1. Make sure you have copilot extention installed and enabled in your VS Code.

2. Create a fine-grained Personal Access Token (PAT) on GitHub Enterprise
   with **Pull Requests: Read & Write** permissions.
  * Repository access (All repositories or select repositories) must be granted.
  * Permissions: 
    * Repository permissions 
      * Pull requests: >  Read & Write
      * Codespaces: >  Read only
      * Commit statuses > Read only
      * Contents > Read and Write
      * Environments > Read only
      * Issues > Read and Write
      * Metadata > Read only
      * Pages > Read only

3. Make sure .copilot-workspace.json file is in the same directory where you started the MCP server.
 
4. Start the MCP server.
  * python mcp_server.py

5. Open VS Code in this folder with Copilot Chat. The MCP tool github.create_pull_request will be available.

---

#### Passing Instructions to the Agent

To automate software-catalog.yaml and Jenkinsfile updates across repositories, provide instructions to the agent as follows:

1. The agent reads the list of repositories from the `GitHub Repository Ownership.csv` file. You do not need to manually list repo names unless you want to limit or customize the selection.
2. Optionally specify requirements for each repo (e.g., owner, description, public/private) or request updates for specific repos by name.
3. The agent will:
   - Extract CODEOWNERS and repo context.
   - Generate or update the software-catalog.yaml file for each repo in the CSV.
   - Update the Jenkinsfile with required stages if needed.
   - Create a branch and open a pull request (PR) for each repo (up to 10 at a time).
   - Squash all changes into one commit per PR.
   - Update the CSV file to record the PR number in the `Copilot Pull request created` column.
   - Skip repos that already have a PR recorded in the CSV.

**Example instruction:**

> Update all repos in GitHub Repository Ownership.csv with a software-catalog.yaml and ensure Jenkinsfile has the publish stage. Limit to 10 PRs at a time.

You can also specify:
- Custom description for each repo
- Whether the repo is public or private
- Any other metadata needed in the YAML

The agent will handle the rest and report PR links for review. The CSV will be updated to track PRs automatically.
