From e0156c6bb6bb8607a0beda0ba12ee8801dfe5fe9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 27 May 2026 15:08:00 +0000 Subject: [PATCH] Add upstream tag sync Copilot skill --- .github/skills/sync-upstream-tags/SKILL.md | 31 +++++++++++ .../scripts/sync-upstream-tags.sh | 51 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 .github/skills/sync-upstream-tags/SKILL.md create mode 100755 .github/skills/sync-upstream-tags/scripts/sync-upstream-tags.sh diff --git a/.github/skills/sync-upstream-tags/SKILL.md b/.github/skills/sync-upstream-tags/SKILL.md new file mode 100644 index 0000000..d416bd1 --- /dev/null +++ b/.github/skills/sync-upstream-tags/SKILL.md @@ -0,0 +1,31 @@ +--- +name: sync-upstream-tags +description: Compare local release tags with git/git tags and create+push each missing version tag in ascending order. +--- + +# Sync Upstream Git Release Tags + +Use this skill when you need to synchronize this repository's release tags with upstream Git releases. + +## Steps + +1. Identify the latest local semantic version tag (`X.Y.Z`) in this repository. +2. Fetch upstream release tags from `https://github.com/git/git/tags`. +3. Compute missing semantic version tags not present locally. +4. Process missing tags in ascending version order (oldest to newest). +5. For each missing tag, run: + - `git tag ` + - `git push origin ` +6. Stop immediately if any command fails, and report which tag failed. + +## Run + +```bash +bash .github/skills/sync-upstream-tags/scripts/sync-upstream-tags.sh +``` + +## Verify + +- [ ] Missing tags were handled from oldest to newest +- [ ] Every created tag was pushed individually +- [ ] No non-semver tags were created diff --git a/.github/skills/sync-upstream-tags/scripts/sync-upstream-tags.sh b/.github/skills/sync-upstream-tags/scripts/sync-upstream-tags.sh new file mode 100755 index 0000000..1c82d02 --- /dev/null +++ b/.github/skills/sync-upstream-tags/scripts/sync-upstream-tags.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +set -euo pipefail + +UPSTREAM_REPO_URL="https://github.com/git/git.git" +SEMVER_PATTERN='^[0-9]+\.[0-9]+\.[0-9]+$' + +mapfile -t local_tags < <(git tag --list | grep -E "$SEMVER_PATTERN" | sort -V || true) +mapfile -t upstream_tags < <( + git ls-remote --tags --refs "$UPSTREAM_REPO_URL" \ + | awk '{print $2}' \ + | sed 's#refs/tags/##' \ + | sed 's/^v//' \ + | grep -E "$SEMVER_PATTERN" \ + | sort -uV +) + +latest_local_tag="" +if ((${#local_tags[@]} > 0)); then + latest_local_tag="${local_tags[-1]}" +fi + +printf 'Latest local semver tag: %s\n' "${latest_local_tag:-}" + +declare -A local_tag_lookup=() +for tag in "${local_tags[@]}"; do + local_tag_lookup["$tag"]=1 +done + +missing_tags=() +for tag in "${upstream_tags[@]}"; do + if [[ -z "${local_tag_lookup[$tag]:-}" ]]; then + missing_tags+=("$tag") + fi +done + +if ((${#missing_tags[@]} == 0)); then + echo "No missing upstream semver tags found." + exit 0 +fi + +printf 'Missing tags to create/push (%d): %s\n' "${#missing_tags[@]}" "${missing_tags[*]}" + +for tag in "${missing_tags[@]}"; do + echo "Creating tag: $tag" + git tag "$tag" + + echo "Pushing tag: $tag" + git push origin "$tag" +done + +echo "Tag synchronization complete."