Skip to content

Update CHANGELOG.md when syncing plugin content to marketplace repos#1908

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/update-changelog-md-sync-plugin-content
Draft

Update CHANGELOG.md when syncing plugin content to marketplace repos#1908
Copilot wants to merge 3 commits intomainfrom
copilot/update-changelog-md-sync-plugin-content

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

The publish-to-marketplace.yml workflow bumps the plugin version on content changes but never updated CHANGELOG.md in the target repos (microsoft/skills and microsoft/azure-skills), leaving version history undocumented.

Changes

.github/scripts/update-changelog.sh (new)

Shared script called by both sync jobs to insert a new versioned entry into the target repo's .github/plugins/azure-skills/CHANGELOG.md:

  • Inserts before the first existing ## [ section; appends at end if none found
  • Derives the actual change list from git diff --cached --name-status, listing each file as Added, Updated, or Removed with its path relative to the plugin root
  • Falls back to a generic message only when no relevant staged files are found
  • Guards against data loss: validates awk output is non-empty before replacing the original
  • Emits actionable warnings/errors if the file is missing or processing fails

.github/workflows/publish-to-marketplace.yml

Both "Bump version if content changed" steps now call the shared script when HAS_CONTENT_CHANGES=true, so the CHANGELOG update is included in the same commit as the version bump:

# Update CHANGELOG.md with new version entry
bash "../source-repo/.github/scripts/update-changelog.sh" \
  ".github/plugins/azure-skills/CHANGELOG.md" "$NEW_VERSION"

The resulting entry reflects the actual sync changes:

## [1.0.2] - 2026-04-16

### Changed

- Updated: `skills/azure-deploy/SKILL.md`
- Added: `skills/azure-upgrade/SKILL.md`
- Removed: `skills/old-skill/SKILL.md`

Copilot AI changed the title [WIP] Update CHANGELOG.md when syncing plugin content Update CHANGELOG.md when syncing plugin content to marketplace repos Apr 16, 2026
Copilot AI requested a review from fanyang-mono April 16, 2026 16:33
Comment thread .github/scripts/update-changelog.sh Outdated
/^## \[/ && !inserted {
print "## [" ver "] - " date
print ""
print "### Changed"
Copy link
Copy Markdown
Contributor

@fanyang-mono fanyang-mono Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Add what actually change in CHANGELOG.md instead of this generic message.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply this fix

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit 4707c63. The script now reads git diff --cached --name-status to build the actual change list, producing entries like:

## [1.0.2] - 2026-04-16

### Changed

- Updated: `skills/azure-deploy/SKILL.md`
- Added: `skills/azure-upgrade/SKILL.md`
- Removed: `skills/old-skill/SKILL.md`

The generic message is kept only as a fallback when no relevant staged files are found.

Copy link
Copy Markdown
Collaborator

@jongio jongio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two issues worth catching before this merges:

  1. Job 2 (microsoft/azure-skills) will produce duplicate changelog lines because that sync fans files out to both .github/plugins/azure-skills/ and the repo root, and both sets end up staged.
  2. Renames from git diff --cached --name-status aren't parsed correctly.

Details inline.


# Update CHANGELOG.md with new version entry
bash "../source-repo/.github/scripts/update-changelog.sh" \
".github/plugins/azure-skills/CHANGELOG.md" "$NEW_VERSION"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Job 2 copies plugin files into .github/plugins/azure-skills/ AND to the repo root (see the "Copy plugin files to repo root" step earlier in this job). Both sets land in git add --all, so git diff --cached --name-status returns each file twice: once under .github/plugins/azure-skills/skills/foo/SKILL.md (which the script strips to skills/foo/SKILL.md) and once at the root path skills/foo/SKILL.md. The changelog entry will list every file twice.

Either dedupe in the script (associative array keyed by final relpath) or scope the diff to .github/plugins/azure-skills/ before feeding the script.


# Fall back to a generic message when no specific changes were found.
if [ ${#CHANGE_LINES[@]} -eq 0 ]; then
CHANGE_LINES=("- Synced plugin files from GitHub-Copilot-for-Azure.")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git diff --cached --name-status emits renames as R<score>\told\tnew (three tab-separated fields). With IFS=$'\t' read -r status filepath the filepath variable swallows both old and new (with the tab between them), producing an entry that contains an embedded tab. rsync doesn't produce renames in the current sync flow so it's low-probability, but it'll misbehave if someone restructures plugin paths. read -r status filepath newpath with a rename branch would cover it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update CHANGELOG.md when syncing plugin content

3 participants