Skip to content

Commit c8b42f2

Browse files
committed
Add Copilot prompt to automate Library.Template updates
This prompt file is intended for use in repos that use this template -- not for this template to use within its own repo directly.
1 parent d10df4b commit c8b42f2

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Template release notes
2+
3+
This file will describe significant changes in Library.Template as they are introduced, especially if they require special consideration when merging updates into existing repos.
4+
This file is referenced by update-library-template.prompt.md and should remain in place to facilitate future merges, whether done manually or by AI.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
description: Merges the latest Library.Template into this repo (at position of HEAD) and resolves conflicts.
3+
---
4+
5+
# Instructions
6+
7+
1. Run `tools\MergeFrom-Template.ps1`
8+
2. Resolve merge conflicts, taking into account conflict resolution policy below.
9+
3. Validate the changes, as described in the validation section below.
10+
4. Commiting your changes (if applicable).
11+
12+
## Conflict resolution policy
13+
14+
There may be special notes in `.github/prompts/template-release-notes.md` that describe special considerations for certain files or scenarios to help you resolve conflicts appropriately.
15+
Always refer to that file before proceeding.
16+
In particular, focus on the *incoming* part of the file, since it represents the changes from the Library.Template that you are merging into your repo.
17+
18+
Also consider that some repos choose to reject certain Library.Template patterns.
19+
For example the template uses MTPv2 for test projects, but a repo might have chosen not to adopt that.
20+
When resolving merge conflicts, consider whether it looks like the relevant code file is older than it should be given the changes the template is bringing in.
21+
Ask the user when in doubt as to whether the conflict should be resolved in favor of 'catching up' with the template or keeping the current changes.
22+
23+
### Keep Current files
24+
25+
Conflicts in the following files should always be resolved by keeping the current version (i.e. discard incoming changes):
26+
27+
* README.md
28+
29+
### Deleted files
30+
31+
Very typically, when the incoming change is to a file that was deleted locally, the correct resolution is to re-delete the file.
32+
33+
In some cases however, the deleted file may have incoming changes that should be applied to other files.
34+
The `test\Library.Tests\Library.Tests.csproj` file is very typical of this.
35+
Changes to this file should very typically be applied to any and all test projects in the repo.
36+
You are responsible for doing this in addition to re-deleting this template file.
37+
38+
## Validation
39+
40+
Validate the merge result (after resolving any conflicts, if applicable).
41+
Use #runSubagent for each step.
42+
43+
1. Verify that `dotnet restore` succeeds. Fix any issues that come up.
44+
2. Verify that `dotnet build` succeeds.
45+
3. Verify that tests succeed by running `tools\dotnet-test-cloud.ps1`.
46+
47+
While these validations are described using `dotnet` CLI commands, some repos require using full msbuild.exe.
48+
You can detect this by checking the `azure-pipelines/dotnet.yml` or `.github/workflows/build.yml` files for use of one or the other tool.
49+
50+
## Committing your changes
51+
52+
If you have to make any changes for validations to pass, consider whether they qualify as a bad merge conflict resolution or more of a novel change that you're making to work with the Library.Template update.
53+
Merge conflict resolution fixes ideally get amended into the merge commit, while novel changes would go into a novel commit after the merge commit.
54+
55+
Always author your commits using `git commit --author "🤖 Copilot <no-reply@github.com>"` (and possibly other parameters).
56+
Describe the nature of the merge conflicts you encountered and how you resolved them in your commit message.
57+
58+
Later, if asked to review pull request validation breaks, always author a fresh commit with each fix that you push, unless the user directs you to do otherwise.

0 commit comments

Comments
 (0)