Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup-copilot/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ runs:
# implementation pinned in .lastmerge by
# .github/scripts/reference-impl-sync/sync-cli-version-from-reference-impl.sh.
run: |
PROP="readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-weekly-reference-impl-sync"
PROP="readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-reference-impl-sync"
VERSION=$(sed -n "s|.*<${PROP}>\(.*\)</${PROP}>.*|\1|p" pom.xml | head -n 1 | tr -d '[:space:]')
if [[ -z "$VERSION" || "$VERSION" == "PRIMER_TO_REPLACE" ]]; then
echo "::error::Could not read pinned @github/copilot version from pom.xml property <${PROP}>" >&2
Expand Down
8 changes: 0 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/scripts/codegen"
schedule:
interval: "daily"
open-pull-requests-limit: 1
allow:
- dependency-name: "@github/copilot"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- Custom instructions for the Copilot coding agent when triggered by the weekly reference implementation sync workflow. -->
<!-- This file is read by .github/workflows/weekly-reference-impl-sync.yml and passed as custom_instructions. -->
<!-- Custom instructions for the Copilot coding agent when triggered by the reference implementation sync workflow. -->
<!-- This file is read by .github/workflows/reference-impl-sync.yml and passed as custom_instructions. -->

Follow the agentic-merge-reference-impl prompt at .github/prompts/agentic-merge-reference-impl.prompt.md
to port reference implementation changes to the Java SDK.
Expand Down
18 changes: 14 additions & 4 deletions .github/scripts/reference-impl-sync/merge-reference-impl-finish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
# 2. Updates .lastmerge to reference implementation HEAD
# 3. Syncs the @github/copilot version property in pom.xml from the
# cloned reference implementation's nodejs/package.json
# 4. Commits the .lastmerge + pom.xml updates
# 5. Pushes the branch to origin
# 4. Syncs scripts/codegen/package.json to the same @github/copilot
# version so the code generator uses matching schemas
# 5. Commits the .lastmerge + pom.xml + codegen package updates
# 6. Pushes the branch to origin
#
# Usage: ./.github/scripts/reference-impl-sync/merge-reference-impl-finish.sh
# ./.github/scripts/reference-impl-sync/merge-reference-impl-finish.sh --skip-tests
Expand Down Expand Up @@ -56,8 +58,16 @@ echo "$NEW_COMMIT" > "$ROOT_DIR/.lastmerge"
echo "▸ Syncing @github/copilot version in pom.xml from reference implementation…"
"$ROOT_DIR/.github/scripts/reference-impl-sync/sync-cli-version-from-reference-impl.sh" "$REFERENCE_IMPL_DIR"

git add .lastmerge pom.xml
git commit -m "Update .lastmerge to $NEW_COMMIT and sync pom.xml CLI version"
# ── 2c. Sync scripts/codegen @github/copilot version ─────────
# Keeps scripts/codegen/package.json in lockstep so the code generator
# uses schemas from the same CLI version that the tests run against.
# This eliminates the gap where Dependabot could race ahead of the
# reference implementation sync.
echo "▸ Syncing @github/copilot version in scripts/codegen/package.json…"
"$ROOT_DIR/.github/scripts/reference-impl-sync/sync-codegen-version.sh" "$REFERENCE_IMPL_DIR"

git add .lastmerge pom.xml scripts/codegen/package.json scripts/codegen/package-lock.json
git commit -m "Update .lastmerge to $NEW_COMMIT, sync pom.xml CLI version, and update scripts/codegen @github/copilot version"

# ── 3. Push branch ───────────────────────────────────────────
echo "▸ Pushing branch $BRANCH_NAME to origin…"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# reference implementation's nodejs/package.json, and updates the
# corresponding property in pom.xml:
#
# <readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-weekly-reference-impl-sync>
# <readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-reference-impl-sync>
#
# This keeps the canonical Copilot CLI version (declared in pom.xml)
# in sync with whatever the reference implementation pinned in
Expand Down Expand Up @@ -65,7 +65,7 @@ if [[ -z "$CLI_VERSION" ]]; then
fi

POM="$ROOT_DIR/pom.xml"
PROP="readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-weekly-reference-impl-sync"
PROP="readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-reference-impl-sync"

if ! grep -q "<${PROP}>" "$POM"; then
echo "❌ Property <${PROP}> not found in $POM" >&2
Expand Down
71 changes: 71 additions & 0 deletions .github/scripts/reference-impl-sync/sync-codegen-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
# ──────────────────────────────────────────────────────────────
# sync-codegen-version.sh
#
# Updates the @github/copilot dependency in scripts/codegen/package.json
# to match the version used by the reference implementation. This keeps
# the code generator schemas in lockstep with the CLI version used for
# testing, eliminating the gap where Dependabot could race ahead.
#
# Usage:
# ./sync-codegen-version.sh <reference-impl-dir>
#
# Or, when invoked from merge-reference-impl-finish.sh, the directory
# is passed as $1.
# ──────────────────────────────────────────────────────────────
set -euo pipefail

# Locate the repo root by walking up from this script until we find a pom.xml.
find_repo_root() {
local dir
dir="$(cd "$(dirname "$0")" && pwd)"
while [[ "$dir" != "/" ]]; do
if [[ -f "$dir/pom.xml" ]]; then
echo "$dir"
return 0
fi
dir="$(dirname "$dir")"
done
echo "❌ Could not locate repo root (no pom.xml found above $(dirname "$0"))" >&2
return 1
}
ROOT_DIR="$(find_repo_root)"

REFERENCE_IMPL_DIR="${1:-${REFERENCE_IMPL_DIR:-}}"
if [[ -z "$REFERENCE_IMPL_DIR" ]]; then
echo "❌ Usage: $0 <reference-impl-dir>" >&2
echo " or set REFERENCE_IMPL_DIR in the environment." >&2
exit 1
fi

PKG_JSON="$REFERENCE_IMPL_DIR/nodejs/package.json"
if [[ ! -f "$PKG_JSON" ]]; then
echo "❌ Cannot find $PKG_JSON" >&2
exit 1
fi

# Extract the @github/copilot version from the reference implementation.
CLI_VERSION=$(node -e \
"const fs=require('fs');const p=JSON.parse(fs.readFileSync(process.argv[1],'utf8'));const v=(p.dependencies&&p.dependencies['@github/copilot'])||(p.devDependencies&&p.devDependencies['@github/copilot']);process.stdout.write(v||'');" \
"$PKG_JSON")

if [[ -z "$CLI_VERSION" ]]; then
echo "❌ Could not extract @github/copilot version from $PKG_JSON" >&2
exit 1
fi

CODEGEN_DIR="$ROOT_DIR/scripts/codegen"
CODEGEN_PKG="$CODEGEN_DIR/package.json"

if [[ ! -f "$CODEGEN_PKG" ]]; then
echo "❌ Cannot find $CODEGEN_PKG" >&2
exit 1
fi

# Update scripts/codegen/package.json with the new version and regenerate the lock file.
# Intentionally omit --save-exact to preserve the version specifier used by the reference
# implementation (e.g. a caret range like '^1.0.36-0' rather than an exact pin '1.0.36-0').
echo "▸ Updating scripts/codegen/package.json: @github/copilot → ${CLI_VERSION}"
cd "$CODEGEN_DIR"
npm install "@github/copilot@${CLI_VERSION}"
echo "▸ Updated scripts/codegen to @github/copilot@${CLI_VERSION}"
Loading
Loading