Skip to content

fix(ci): use tree-hash anchor for accurate promotion commit list#1197

Merged
castrojo merged 1 commit intoublue-os:mainfrom
castrojo:fix/create-lts-pr-squash-commit-list
Mar 17, 2026
Merged

fix(ci): use tree-hash anchor for accurate promotion commit list#1197
castrojo merged 1 commit intoublue-os:mainfrom
castrojo:fix/create-lts-pr-squash-commit-list

Conversation

@castrojo
Copy link
Collaborator

... and of course I messed it up, one more. :)

Solution

Find the most-recent commit on main whose tree hash matches the current lts tree. Since squash-merges preserve content exactly, this is always the main commit that was squash-merged into lts. git log is anchored from that point, showing only genuinely new commits regardless of squash-merge history.

If no match is found within 500 commits (first-ever promotion), falls back to git diff --name-status.

Also fixed

  • Removed || true from gh pr edit — failures now surface visibly instead of silently leaving the PR body stale
  • Added guard: if git diff detects a difference but origin/lts..origin/main is empty (lts is ahead/diverged), skip rather than open a misleading empty PR

Addresses Copilot review comments from #1195.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com
Assisted-by: Claude Sonnet 4.6 via GitHub Copilot

@castrojo castrojo requested a review from tulilirockz as a code owner March 17, 2026 22:36
Copilot AI review requested due to automatic review settings March 17, 2026 22:36
After a squash-merge promotion, git log origin/lts..origin/main lists
every individual commit that was squash-merged (since lts only has one
squash commit, not the individual ones). This caused the promotion PR
body to bloat on every subsequent run.

Fix by finding the most-recent commit on main whose tree hash matches
the current lts tree — this is always the exact main commit that was
squash-merged into lts. git log is then anchored from that point,
showing only genuinely new commits regardless of squash-merge history.

Also remove || true from gh pr edit so failures surface visibly, and
add a guard to skip PR creation when lts is ahead/diverged from main
with no commits to promote.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Assisted-by: Claude Sonnet 4.6 via GitHub Copilot
@castrojo castrojo force-pushed the fix/create-lts-pr-squash-commit-list branch from 7d2f542 to c6ff3da Compare March 17, 2026 22:36
@castrojo castrojo merged commit a764cfc into ublue-os:main Mar 17, 2026
14 of 16 checks passed
@github-actions github-actions bot mentioned this pull request Mar 17, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the mainlts promotion mechanism by replacing the manual workflow_dispatch-based squash-push workflow with an automated, human-gated draft PR flow, and refreshes the CI/CD documentation accordingly.

Changes:

  • Document the PR-gated mainlts promotion flow and update release schedule references in AGENTS.md.
  • Remove the legacy .github/workflows/promote-to-lts.yml workflow.
  • Add .github/workflows/create-lts-pr.yml to auto-create/update a draft PR from main to lts when content differs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
AGENTS.md Updates the authoritative CI/CD reference to describe PR-gated promotion and the Tuesday release schedule.
.github/workflows/promote-to-lts.yml Removes the old manual squash-push promotion workflow.
.github/workflows/create-lts-pr.yml Adds automation to create/update the mainlts promotion PR and generate a promotion commit list.
Comments suppressed due to low confidence (1)

.github/workflows/create-lts-pr.yml:81

  • gh pr list --head main can match PRs from forks whose branch name is also main (since --head can be ambiguous when not owner-qualified). To avoid accidentally editing the wrong PR, consider using an owner-qualified head ref (e.g., ${{ github.repository_owner }}:main) and passing -R ${{ github.repository }} consistently for the gh calls.
          EXISTING=$(gh pr list \
            --base lts \
            --head main \
            --state open \
            --json number \
            --jq '.[0].number' \
            2>/dev/null || echo "")

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 32 to 39
if git diff --quiet origin/lts origin/main; then
echo "No content difference between lts and main. Nothing to promote."
echo "has_diff=false" >> "$GITHUB_OUTPUT"
elif [ -z "$(git log origin/lts..origin/main --oneline)" ]; then
echo "lts is ahead of or diverged from main with no commits to promote. Nothing to promote."
echo "has_diff=false" >> "$GITHUB_OUTPUT"
else
echo "has_diff=true" >> "$GITHUB_OUTPUT"
Comment on lines +50 to +57
ANCHOR=$(git log origin/main --format="%H %T" --max-count=500 \
| awk -v t="$LTS_TREE" '$2==t{print $1; exit}')

if [ -n "$ANCHOR" ]; then
LIST=$(git log "${ANCHOR}..origin/main" --oneline)
else
# Fallback when the tree match isn't in recent history (e.g., first ever promotion).
LIST=$(git diff --name-status origin/lts origin/main)
@castrojo castrojo deleted the fix/create-lts-pr-squash-commit-list branch March 17, 2026 22:42
castrojo added a commit that referenced this pull request Mar 17, 2026
## Commits pending promotion to `lts`

a764cfc fix(ci): use tree-hash anchor for accurate promotion commit list
(#1197)
6462f99 ci(promote): replace push-based promotion with PR gate (#1195)
dd4152f chore(deps): update quay.io/centos-bootc/centos-bootc:c10s
docker digest to 7b1e3d1 (#1194)
1658526 chore(deps): update
system_files/usr/share/gnome-shell/extensions/search-light@icedman.github.com
digest to 4e93e0e (#1193)
aa14da4 chore(deps): update quay.io/centos-bootc/centos-bootc:c10s
docker digest to b10c380 (#1191)
1ff0c7e Revert "feat(GNOME) : gnome 49 backport" (#1192)
18bb989 chore(deps): update quay.io/centos-bootc/centos-bootc:c10s
docker digest to ff6f31c (#1185)
24765e4 feat(GNOME) : gnome 49 backport (#1187)
bc65f2a chore(deps): update
system_files/usr/share/gnome-shell/extensions/search-light@icedman.github.com
digest to e4ad180 (#1190)
914432d chore(deps): update ghcr.io/ublue-os/brew:latest docker digest
to fef8b47 (#1189)
1339bc4 chore(deps): update cgr.dev/chainguard/wolfi-base:latest docker
digest to 2a43204 (#1188)
4e13431 chore(deps): update ghcr.io/projectbluefin/common:latest docker
digest to 9409d0c (#1186)
6a0ad87 chore(deps): update cgr.dev/chainguard/wolfi-base:latest docker
digest to a9a3a0c (#1184)
8e1c75f chore(deps): update ghcr.io/projectbluefin/common:latest docker
digest to 69e0d5c (#1174)
90132e8 chore(deps): update cgr.dev/chainguard/wolfi-base:latest docker
digest to 08420c1 (#1181)
b23f809 chore(deps): update actions/download-artifact digest to 3e5f45b
(#1183)
13f9b46 chore(deps): update quay.io/centos-bootc/centos-bootc:c10s
docker digest to c2dba5f (#1182)
7316e19 chore(deps): update cgr.dev/chainguard/wolfi-base:latest docker
digest to 00f9662 (#1156)

---
_Squash-merge this PR to promote. The PR body updates automatically as
`main` advances._

---------

Co-authored-by: ubot-7274[bot] <217212047+ubot-7274[bot]@users.noreply.github.com>
Co-authored-by: James Reilly <jreilly1821@gmail.com>
Co-authored-by: Jorge O. Castro <jorge.castro@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants