CI: Fetch minimal history before GitHub push

The trigger_snap_builds job fails when pushing to GitHub because GitLab
uses shallow clones by default. GitHub may expect objects that aren't
present in the shallow clone.

Fix this by fetching only the commits needed: first get GitHub's current
master (depth=1), then fetch from origin only commits since that date.
This is much faster than fetching the entire history.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-12-21 11:58:49 -07:00
parent 5499abcf69
commit 44b7a6a332

View File

@@ -978,5 +978,7 @@ trigger_snap_builds:
git config --global --add safe.directory $CI_PROJECT_DIR
cd $CI_PROJECT_DIR
git remote add github git@github.com:sjg20/u-boot-concept.git || true
git fetch github master --depth=1
git fetch origin --shallow-since=$(git log -1 --format=%ci github/master)
git push github HEAD:master --force
echo "GitHub push completed"