Bump D-Modem to 3f7d6b2 (USRobotics x2 server); bump it automatically

external/d-modem-re: a3aaade -> 3f7d6b2, D-Modem's main (33 commits,
the x2 server from D-Modem#104 among them). The native engine builds
and its tests pass on it (native-test, 14/14).

A D-Modem bump workflow keeps it there: daily, by hand or on a
repository_dispatch from D-Modem it opens a pull request moving the
submodule to D-Modem's main, set to merge once the checks pass. It
needs a DMODEM_BUMP_TOKEN secret.

Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRgas5TD8Qpbs8x2NK
This commit is contained in:
Claude committed 2026-11-09 12:53:59 +00:00
1 parent 67fff7ef88
commit ec8a53747a
3 files changed
+121 -1

No files matched your search

+115
View File
@@ -0,0 +1,115 @@
# D-Modem bump: moves the external/d-modem-re submodule to D-Modem's
# latest main and opens (or updates) a pull request for it, set to merge
# by itself once its checks pass. Daily, by hand (Actions > D-Modem bump >
# Run workflow), or from D-Modem (a repository_dispatch of type
# "d-modem-main", for when its main changes).
#
# It needs the DMODEM_BUMP_TOKEN secret: a fine-grained personal access
# token with Contents: read on D-Modem/D-Modem (the private submodule)
# and Contents: read and write and Pull requests: read and write on
# D-Modem/app. Not the workflow's own GITHUB_TOKEN: a pull request that
# token opens starts no other workflow, so Android's checks would never
# run on it. Without the secret the run says so and stops.
#
# Merging by itself takes the repository's "Allow auto-merge" setting and
# a rule on main that requires the Android checks; without those the pull
# request stays open for a person to merge.
name: D-Modem bump
on:
schedule:
- cron: "17 6 * * *"
repository_dispatch:
types: [d-modem-main]
workflow_dispatch:
# (one bump at a time: a second waits for the first)
concurrency:
group: d-modem-bump
cancel-in-progress: false
permissions:
contents: read
env:
BRANCH: bot/d-modem-bump
jobs:
bump:
runs-on: ubuntu-24.04
# (a hung step ends here, not at GitHub's 6 hours)
timeout-minutes: 10
steps:
- name: Token present
env:
TOKEN: ${{ secrets.DMODEM_BUMP_TOKEN }}
run: |
if [ -z "$TOKEN" ]; then
echo "::error::No DMODEM_BUMP_TOKEN secret (see this workflow's header)"
exit 1
fi
- uses: actions/checkout@v6
with:
token: ${{ secrets.DMODEM_BUMP_TOKEN }}
fetch-depth: 0
# only the D-Modem submodule (proot stays where it is)
- name: D-Modem's latest main
id: bump
run: |
git submodule update --init external/d-modem-re
old=$(git -C external/d-modem-re rev-parse HEAD)
git -C external/d-modem-re fetch --quiet origin main
new=$(git -C external/d-modem-re rev-parse FETCH_HEAD)
echo "old=$old" >> "$GITHUB_OUTPUT"
echo "new=$new" >> "$GITHUB_OUTPUT"
if [ "$old" = "$new" ]; then
echo "Already at D-Modem main ${new:0:7}"
echo "changed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
git -C external/d-modem-re checkout --quiet "$new"
echo "changed=true" >> "$GITHUB_OUTPUT"
{
echo 'log<<EOF'
git -C external/d-modem-re log --oneline --no-merges "$old..$new" | head -50
echo 'EOF'
} >> "$GITHUB_OUTPUT"
- name: Commit and push
if: steps.bump.outputs.changed == 'true'
env:
OLD: ${{ steps.bump.outputs.old }}
NEW: ${{ steps.bump.outputs.new }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B "$BRANCH"
git add external/d-modem-re
git commit -m "Bump D-Modem to ${NEW:0:7}" \
-m "external/d-modem-re: ${OLD:0:7} -> ${NEW:0:7} (D-Modem's main)." \
-m "Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
git push --force origin "$BRANCH"
- name: Pull request, merging by itself
if: steps.bump.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.DMODEM_BUMP_TOKEN }}
OLD: ${{ steps.bump.outputs.old }}
NEW: ${{ steps.bump.outputs.new }}
LOG: ${{ steps.bump.outputs.log }}
run: |
body=$(printf 'Moves `external/d-modem-re` to D-Modem main: [`%s..%s`](https://github.com/D-Modem/D-Modem/compare/%s...%s)\n\n```\n%s\n```\n\nOpened by the D-Modem bump workflow (`.github/workflows/d-modem-bump.yml`); it merges once the checks pass.\n' \
"${OLD:0:7}" "${NEW:0:7}" "$OLD" "$NEW" "$LOG")
title="Bump D-Modem to ${NEW:0:7}"
pr=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number')
if [ -n "$pr" ]; then
gh pr edit "$pr" --title "$title" --body "$body"
else
gh pr create --base main --head "$BRANCH" --title "$title" --body "$body"
pr=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number')
fi
if ! gh pr merge "$pr" --auto --merge; then
echo "::warning::Couldn't set pull request #$pr to merge by itself (Allow auto-merge off, or no required checks on main): it waits for a person"
fi