You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rewrite the prompt from documentation-style to clear imperative
instructions. The agent previously misinterpreted the documentation
as instructions to perform the merge itself (invoking the
agentic-merge-upstream skill), then failed because it couldn't
push code from the sandbox.
The new prompt:
- Gives explicit step-by-step instructions
- Provides bash commands for upstream change detection
- Directs the agent to use safe-output tools (create_issue,
close_issue, assign_to_agent, noop)
- Explicitly prohibits invoking skills, editing files, or pushing code
Only the markdown content changed; frontmatter is unchanged so no
lock file recompilation is needed.
Agent-Logs-Url: https://github.com/github/copilot-sdk-java/sessions/945e9454-9363-45bc-b281-0fe3d6c87019
Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
Copy file name to clipboardExpand all lines: .github/workflows/weekly-upstream-sync.md
+50-84Lines changed: 50 additions & 84 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,111 +41,77 @@ safe-outputs:
41
41
noop:
42
42
report-as-issue: false
43
43
---
44
-
# Weekly Upstream Sync Agentic Workflow
45
-
This document describes the `weekly-upstream-sync.yml` GitHub Actions workflow, which automates the detection of new changes in the official [Copilot SDK](https://github.com/github/copilot-sdk) and delegates the merge work to the Copilot coding agent.
44
+
# Weekly Upstream Sync
46
45
47
-
## Overview
46
+
You are an automation agent that detects new upstream changes and creates GitHub issues. You do **NOT** perform any code merges, edits, or pushes. Do **NOT** invoke any skills (especially `agentic-merge-upstream`). Your only job is to check for changes and use safe-output tools to create or close issues.
48
47
49
-
The workflow runs on a **weekly schedule** (every Monday at 10:00 UTC) and can also be triggered manually. It does **not** perform the actual merge — instead, it detects upstream changes and creates a GitHub issue assigned to `copilot`, instructing the agent to follow the [agentic-merge-upstream](../prompts/agentic-merge-upstream.prompt.md) prompt to port the changes.
48
+
## Instructions
50
49
51
-
The agent must also create the Pull Request with the label `upstream-sync`. This allows the workflow to track the merge progress and avoid creating duplicate issues if the agent is still working on a previous sync.
50
+
Follow these steps exactly:
52
51
53
-
##Trigger
52
+
### Step 1: Read `.lastmerge`
54
53
55
-
| Trigger | Schedule |
56
-
|---|---|
57
-
|`schedule`| Every Monday at 10:00 UTC (`0 10 * * 1`) |
58
-
|`workflow_dispatch`| Manual trigger from the Actions tab |
54
+
Read the file `.lastmerge` in the repository root. It contains the SHA of the last upstream commit that was merged into this Java SDK.
59
55
60
-
##Workflow Steps
56
+
### Step 2: Check for upstream changes
61
57
62
-
### 1. Checkout repository
58
+
Clone the upstream repository and compare commits:
63
59
64
-
Checks out the repo to read the `.lastmerge` file, which contains the SHA of the last upstream commit that was merged into the Java SDK.
65
-
66
-
### 2. Check for upstream changes
67
-
68
-
- Reads the last merged commit hash from `.lastmerge`
69
-
- Clones the upstream `github/copilot-sdk` repository
70
-
- Compares `.lastmerge` against upstream `HEAD`
71
-
- If they match: sets `has_changes=false`
72
-
- If they differ: counts new commits, generates a summary (up to 20 most recent), and sets outputs (`commit_count`, `upstream_head`, `last_merge`, `summary`)
73
-
74
-
### 3. Close previous upstream-sync issues (when changes found)
Before creating a new issue, closes any existing open issues with the `upstream-sync` label. This prevents stale issues from accumulating when previous sync attempts were incomplete or superseded. Each closed issue receives a comment explaining it was superseded.
67
+
If `LAST_MERGE` equals `UPSTREAM_HEAD`, there are **no new changes**. Go to Step 3a.
79
68
80
-
### 4. Close stale upstream-sync issues (when no changes found)
69
+
If they differ, count the new commits and generate a summary:
SUMMARY=$(git log --oneline "$LAST_MERGE".."$UPSTREAM_HEAD"| head -20)
74
+
```
83
75
84
-
If the upstream is already up to date, closes any lingering open `upstream-sync` issues with a comment noting that no changes were detected. This handles the case where a previous issue was created but the changes were merged manually (updating `.lastmerge`) before the agent completed.
76
+
Go to Step 3b.
85
77
86
-
### 5. Create issue and assign to Copilot
78
+
### Step 3a: No changes detected
87
79
88
-
**Condition:**`has_changes == true`
80
+
1. Search for any open issues with the `upstream-sync` label using the GitHub MCP tools.
81
+
2. If there are open `upstream-sync` issues, close each one using the `close_issue` safe-output tool with a comment: "No new upstream changes detected. The Java SDK is up to date. Closing."
82
+
3. Call the `noop` safe-output tool with message: "No new upstream changes since last merge (<LAST_MERGE>)."
83
+
4.**Stop here.** Do not proceed further.
89
84
90
-
Creates a new GitHub issue with:
85
+
### Step 3b: Changes detected
91
86
92
-
-**Title:**`Upstream sync: N new commits (YYYY-MM-DD)`
93
-
-**Label:**`upstream-sync`
94
-
-**Assignee:**`copilot`
95
-
-**Body:** Contains commit count, commit range links, a summary of recent commits, and a link to the merge prompt
87
+
1. Search for any open issues with the `upstream-sync` label using the GitHub MCP tools.
88
+
2. Close each existing open `upstream-sync` issue using the `close_issue` safe-output tool with a comment: "Superseded by a newer upstream sync check."
89
+
3. Create a new issue using the `create_issue` safe-output tool with:
90
+
-**Title:**`Upstream sync: <COMMIT_COUNT> new commits (<YYYY-MM-DD>)`
91
+
-**Body:** Include the following information:
92
+
```
93
+
## Automated Upstream Sync
96
94
97
-
The Copilot coding agent picks up the issue, creates a branch and PR, then follows the merge prompt to port the changes.
95
+
There are **<COMMIT_COUNT>** new commits in the [official Copilot SDK](https://github.com/github/copilot-sdk) since the last merge.
0 commit comments