From 2b0eed5d162ae9074d3a8090b2735f35baff5a95 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 13:40:12 +0000 Subject: [PATCH 1/2] CI: move the built-in modem to D-Modem's main and build d-modem-bump.yml starts on D-Modem's d-modem-main event, each day, or manually. It opens a pull request that moves external/D-Modem, waits for Build and merges. It needs the DMODEM_BUMP_TOKEN secret. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01B82eRT9xSDzhZPJHVyrj6o --- .github/workflows/d-modem-bump.yml | 144 +++++++++++++++++++++++++++++ README.md | 4 +- docs/building.md | 12 +++ 3 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/d-modem-bump.yml diff --git a/.github/workflows/d-modem-bump.yml b/.github/workflows/d-modem-bump.yml new file mode 100644 index 0000000..f8ec87b --- /dev/null +++ b/.github/workflows/d-modem-bump.yml @@ -0,0 +1,144 @@ +# D-Modem bump: moves the external/D-Modem submodule (the built-in +# modem) to the latest main of D-Modem. It opens a pull request for the +# change, or updates the open one. Build (build.yml) builds and tests +# the apps in that pull request. The workflow merges the pull request +# when all of its checks pass. Build then runs on main, and the next +# nightly release (nightly.yml) has the new apps. +# +# It starts: +# - from D-Modem, when its main changes (a repository_dispatch event of +# type "d-modem-main", from D-Modem's .github/workflows/dependents.yml); +# - each day (for an event that did not come); +# - manually (Actions > D-Modem bump > Run workflow). +# +# It needs the DMODEM_BUMP_TOKEN secret: a fine-grained personal access +# token with Contents: read and write and Pull requests: read and write +# on D-Modem/gui, and Contents: read on D-Modem/D-Modem. Do not use the +# workflow's own GITHUB_TOKEN: a pull request that this token opens +# starts no other workflow, thus Build does not run on it. Without the +# secret, the run gives an error and stops. +# +# The workflow waits for the checks before it merges: with no required +# checks on main, GitHub's auto-merge merges immediately. If a check +# fails, the pull request stays open for a person. +name: D-Modem bump + +on: + schedule: + - cron: "47 6 * * *" + repository_dispatch: + types: [d-modem-main] + workflow_dispatch: + +# (one bump at a time: a second run 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 + # (Build takes about 35 minutes; a hung step stops here, not at + # GitHub's 6 hours) + timeout-minutes: 90 + 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@v4 + with: + token: ${{ secrets.DMODEM_BUMP_TOKEN }} + fetch-depth: 0 + + - name: D-Modem's latest main + id: bump + run: | + git submodule update --init external/D-Modem + old=$(git -C external/D-Modem rev-parse HEAD) + git -C external/D-Modem fetch --quiet origin main + new=$(git -C external/D-Modem 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 checkout --quiet "$new" + echo "changed=true" >> "$GITHUB_OUTPUT" + { + echo 'log<> "$GITHUB_OUTPUT" + + - name: Commit and push + id: commit + 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 + git commit -m "Bump D-Modem to ${NEW:0:7}" \ + -m "external/D-Modem: ${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" + echo "head=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + + - name: Pull request + id: pr + 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` 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 when 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 + echo "number=$pr" >> "$GITHUB_OUTPUT" + + # (the checks need some seconds to start; then the step waits for + # all of them) + - name: Merge when the checks pass + if: steps.bump.outputs.changed == 'true' + env: + GH_TOKEN: ${{ secrets.DMODEM_BUMP_TOKEN }} + PR: ${{ steps.pr.outputs.number }} + HEAD: ${{ steps.commit.outputs.head }} + run: | + for i in $(seq 1 20); do + n=$(gh pr checks "$PR" --json name --jq length 2>/dev/null || true) + [ "${n:-0}" -gt 0 ] && break + sleep 15 + done + sleep 30 + if ! gh pr checks "$PR" --watch --interval 30; then + echo "::warning::A check failed on pull request #$PR: it waits for a person" + exit 1 + fi + gh pr merge "$PR" --merge --match-head-commit "$HEAD" diff --git a/README.md b/README.md index 03875fb..8142102 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,9 @@ has the apps from the newest build of `main`. It has the Windows app (for Windows 95 and later, and for Windows 7 and later), the Linux app, the macOS app, and the Windows app for Linux and macOS. A workflow (`.github/workflows/nightly.yml`) replaces the release one time each day. -When `main` has no new commits, the release does not change. +When `main` has no new commits, the release does not change. When the +main branch of D-Modem changes, a workflow moves the built-in modem to it +and builds the apps again (refer to [Building](docs/building.md)). These builds are not stable releases. The files are not signed. Thus Windows and macOS can show a warning before the app starts. diff --git a/docs/building.md b/docs/building.md index 6bcc1bd..d07d0be 100644 --- a/docs/building.md +++ b/docs/building.md @@ -58,3 +58,15 @@ is older than 0.11. The Settings page needs a dmodemd with AT!M (the main branch of D-Modem since D-Modem/D-Modem#103). The other pages operate with all versions of D-Modem 1.0. + +## Updates from D-Modem + +The workflow `.github/workflows/d-modem-bump.yml` keeps the submodule +`external/D-Modem` on the main branch of D-Modem. It starts when the main +branch of D-Modem changes, one time each day, or when you start it +manually. It opens a pull request that moves the submodule. Build +(`.github/workflows/build.yml`) builds and tests the apps in that pull +request. The workflow merges the pull request when all checks pass. If a +check fails, the pull request stays open for a person. The workflow needs +a `DMODEM_BUMP_TOKEN` secret. The header of the workflow gives the +necessary permissions. From 66d27a97028b7e702ce5232ff1be80bb317e486d Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 13:51:05 +0000 Subject: [PATCH 2/2] CI: DMODEM_BUMP_TOKEN is an organization secret Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01B82eRT9xSDzhZPJHVyrj6o --- .github/workflows/d-modem-bump.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/d-modem-bump.yml b/.github/workflows/d-modem-bump.yml index f8ec87b..1d695ac 100644 --- a/.github/workflows/d-modem-bump.yml +++ b/.github/workflows/d-modem-bump.yml @@ -11,9 +11,9 @@ # - each day (for an event that did not come); # - manually (Actions > D-Modem bump > Run workflow). # -# It needs the DMODEM_BUMP_TOKEN secret: a fine-grained personal access -# token with Contents: read and write and Pull requests: read and write -# on D-Modem/gui, and Contents: read on D-Modem/D-Modem. Do not use the +# It needs the DMODEM_BUMP_TOKEN secret (an organization secret): a +# fine-grained personal access token with Contents: read and write and +# Pull requests: read and write on D-Modem/gui. Do not use the # workflow's own GITHUB_TOKEN: a pull request that this token opens # starts no other workflow, thus Build does not run on it. Without the # secret, the run gives an error and stops.