From 9b8566dca2a8484bf2807d6c91a5986e016c7a13 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Wed, 11 Nov 2026 12:25:47 +0000 Subject: [PATCH 1/2] .github: Include any additional commits when updating gentoo submodule Quite often, bumping the gentoo submodule requires additional fixes. We can push these to the auto-created branch, but if we don't verify and merge them by the time the job runs again, those commits get lost and the subsequent build will fail again. This change cherry-picks any additional commits made to the existing branch when recreating it. If this fails for some reason, it just continues without the additional commits. Signed-off-by: James Le Cuirot --- ...ate-portage-stable-packages-from-list.yaml | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/update-portage-stable-packages-from-list.yaml b/.github/workflows/update-portage-stable-packages-from-list.yaml index 8a45e31f2bb..000b6e22ca4 100644 --- a/.github/workflows/update-portage-stable-packages-from-list.yaml +++ b/.github/workflows/update-portage-stable-packages-from-list.yaml @@ -12,6 +12,7 @@ jobs: uses: actions/checkout@v7 with: token: ${{ secrets.BOT_PR_TOKEN }} + ref: ${{ github.event.repository.default_branch }} path: scripts sparse-checkout: | .gitmodules @@ -19,23 +20,39 @@ jobs: sparse-checkout-cone-mode: false - name: Update Gentoo submodule id: update-gentoo + working-directory: scripts env: WORK_SCRIPTS_DIR: "${{ github.workspace }}/scripts" run: | set -euo pipefail - source scripts/.github/workflows/common.sh + source .github/workflows/common.sh prepare_git_repo submodule=sdk_container/src/third_party/gentoo - url=$(git -C "${WORK_SCRIPTS_DIR}" config --file .gitmodules --get "submodule.${submodule}.url") - branch=$(git -C "${WORK_SCRIPTS_DIR}" config --file .gitmodules --get "submodule.${submodule}.branch") + url=$(git config --file .gitmodules --get "submodule.${submodule}.url") + branch=$(git config --file .gitmodules --get "submodule.${submodule}.branch") read -r latest_commit _ < <(git ls-remote --exit-code "${url}" "refs/heads/${branch}") short_commit=${latest_commit:0:12} - git -C "${WORK_SCRIPTS_DIR}" update-index --cacheinfo "160000,${latest_commit},${submodule}" - if git -C "${WORK_SCRIPTS_DIR}" diff --cached --quiet -- "${submodule}"; then + git update-index --cacheinfo "160000,${latest_commit},${submodule}" + if git diff --cached --quiet -- "${submodule}"; then echo 'UPDATE_NEEDED=0' >>"${GITHUB_OUTPUT}" exit 0 fi - git -C "${WORK_SCRIPTS_DIR}" commit --signoff -m "gentoo: Update to ${short_commit}" + git commit --signoff -m "gentoo: Update to ${short_commit}" + previous_branch="buildbot/update-gentoo-submodule" + default_branch="${{ github.event.repository.default_branch }}" + if git fetch --no-tags --no-recurse-submodules --depth=1000 origin \ + "+refs/heads/${previous_branch}:refs/remotes/origin/${previous_branch}"; then + git fetch --no-tags --no-recurse-submodules --deepen=1000 origin "${default_branch}" + additional_commits=$(git rev-list --reverse --no-merges \ + "origin/${default_branch}..origin/${previous_branch}" -- ":^:${submodule}") + if [[ -n "${additional_commits}" ]]; then + mapfile -t commits <<< "${additional_commits}" + if ! git cherry-pick "${commits[@]}"; then + echo '::warning::Could not replay additional commits; keeping only the Gentoo submodule update.' + git cherry-pick --abort + fi + fi + fi cleanup_repo echo 'UPDATE_NEEDED=1' >>"${GITHUB_OUTPUT}" echo "LATEST_COMMIT=${latest_commit}" >>"${GITHUB_OUTPUT}" From 1f8341e41efb873fc4311e4947cb727388157737 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Wed, 11 Nov 2026 13:15:47 +0000 Subject: [PATCH 2/2] .github: Rename gentoo submodule update workflow from old name We initially kept the old name for easier testing. Signed-off-by: James Le Cuirot --- ...table-packages-from-list.yaml => update-gentoo-submodule.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{update-portage-stable-packages-from-list.yaml => update-gentoo-submodule.yaml} (100%) diff --git a/.github/workflows/update-portage-stable-packages-from-list.yaml b/.github/workflows/update-gentoo-submodule.yaml similarity index 100% rename from .github/workflows/update-portage-stable-packages-from-list.yaml rename to .github/workflows/update-gentoo-submodule.yaml