Skip to content

Commit cb97024

Browse files
committed
Update custom instructions in upstream sync workflow to clarify handling of irrelevant changes
1 parent f9dde36 commit cb97024

3 files changed

Lines changed: 36 additions & 8 deletions

File tree

‎.github/prompts/agentic-merge-upstream.prompt.md‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ All scripts write/read a `.merge-env` file (git-ignored) to share state (branch
3535
5. Run `./.github/scripts/format-and-test.sh` frequently while porting
3636
6. Update documentation
3737
7. Run `./.github/scripts/merge-upstream-finish.sh` (final test + push)
38-
8. Create Pull Request
38+
8. Finalize Pull Request (see note below about coding agent vs. manual workflow)
3939

4040
---
4141

@@ -316,7 +316,7 @@ Ensure consistency across all documentation files:
316316
- Code examples should use the same patterns and be tested
317317
- Links to Javadoc should use correct paths (`apidocs/...`)
318318

319-
## Steps 11-12: Finish, Push, and Create Pull Request
319+
## Steps 11-12: Finish, Push, and Finalize Pull Request
320320

321321
Run the finish script which updates `.lastmerge`, runs a final build, and pushes the branch:
322322

@@ -325,11 +325,17 @@ Run the finish script which updates `.lastmerge`, runs a final build, and pushes
325325
./.github/scripts/merge-upstream-finish.sh --skip-tests # if tests already passed
326326
```
327327

328-
**After pushing, create the Pull Request using the GitHub MCP tool (`mcp_github_create_pull_request`).**
328+
### PR Handling: Coding Agent vs. Manual Workflow
329329

330-
Use `owner: copilot-community-sdk`, `repo: copilot-sdk-java`, `head: $BRANCH_NAME`, `base: main`.
330+
**If running as a Copilot coding agent** (triggered via GitHub issue assignment by the weekly sync workflow), a pull request has **already been created automatically** for you. Do NOT create a new one. Just push your commits to the current branch — the existing PR will be updated. Add the `upstream-sync` label to the existing PR:
331331

332-
**After creating the PR, add the `upstream-sync` label** using the `gh` CLI:
332+
```bash
333+
gh pr edit <PR_NUMBER> --add-label "upstream-sync"
334+
```
335+
336+
> **No-changes scenario (coding agent only):** If after analyzing the upstream diff there are no relevant changes to port to the Java SDK, close the auto-created pull request, then close the triggering issue as "not planned" with a comment explaining that no changes were applicable.
337+
338+
**If running manually** (e.g., from VS Code via the reusable prompt), create the Pull Request using the GitHub MCP tool (`mcp_github_create_pull_request`). Use `owner: copilot-community-sdk`, `repo: copilot-sdk-java`, `head: $BRANCH_NAME`, `base: main`. Then add the label:
333339

334340
```bash
335341
gh pr edit <PR_NUMBER> --add-label "upstream-sync"
@@ -380,7 +386,7 @@ Before finishing:
380386
3. Ensure no unintended changes were made
381387
4. Verify code follows project conventions
382388
5. Confirm the branch was pushed to remote
383-
6. Confirm the Pull Request was created and provide the PR URL to the user
389+
6. Confirm the Pull Request is ready (created or updated) and provide the PR URL to the user
384390

385391
---
386392

@@ -407,7 +413,7 @@ Before finishing:
407413
- [ ] `src/site/site.xml` updated if new documentation pages were added
408414
- [ ] `.lastmerge` file updated with new commit hash
409415
- [ ] Branch pushed to remote
410-
- [ ] **Pull Request created** via GitHub MCP tool (`mcp_github_create_pull_request`)
416+
- [ ] **Pull Request finalized** (coding agent: push to existing PR; manual: create via `mcp_github_create_pull_request`)
411417
- [ ] **`upstream-sync` label added** to the PR via `gh pr edit --add-label "upstream-sync"`
412418
- [ ] PR URL provided to user
413419

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!-- Custom instructions for the Copilot coding agent when triggered by the weekly upstream sync workflow. -->
2+
<!-- This file is read by .github/workflows/weekly-upstream-sync.yml and passed as custom_instructions. -->
3+
4+
Follow the agentic-merge-upstream prompt at .github/prompts/agentic-merge-upstream.prompt.md
5+
to port upstream changes to the Java SDK.
6+
7+
Use the utility scripts in .github/scripts/ for initialization, diffing, formatting, and testing.
8+
Commit changes incrementally. Update .lastmerge when done.
9+
10+
IMPORTANT: A pull request has already been created automatically for you — do NOT create a new
11+
one. Push your commits to the current branch, and the existing PR will be updated.
12+
13+
Add the 'upstream-sync' label to the existing PR using:
14+
15+
gh pr edit <PR_NUMBER> --add-label upstream-sync
16+
17+
If after analyzing the upstream diff there are no relevant changes to port to the Java SDK,
18+
close the pull request that was automatically created for you, then close this issue as
19+
'not planned' with a comment explaining that no changes were applicable.

‎.github/workflows/weekly-upstream-sync.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ jobs:
122122
BODY="${BODY//UPSTREAM_HEAD_PLACEHOLDER/$UPSTREAM_HEAD}"
123123
BODY="${BODY//SUMMARY_PLACEHOLDER/$SUMMARY}"
124124
125+
# Read custom instructions from external file
126+
CUSTOM_INSTRUCTIONS=$(cat .github/prompts/coding-agent-merge-instructions.md)
127+
125128
# Create issue and assign to Copilot coding agent
126129
gh api \
127130
--method POST \
@@ -137,7 +140,7 @@ jobs:
137140
"agent_assignment": {
138141
"target_repo": "${{ github.repository }}",
139142
"base_branch": "main",
140-
"custom_instructions": "Follow the agentic-merge-upstream prompt at .github/prompts/agentic-merge-upstream.prompt.md to port upstream changes to the Java SDK. Use the utility scripts in .github/scripts/ for initialization, diffing, formatting, and testing. Commit changes incrementally. Update .lastmerge when done."
143+
"custom_instructions": $(echo "$CUSTOM_INSTRUCTIONS" | jq -Rs .)
141144
}
142145
}
143146
EOF

0 commit comments

Comments
 (0)