Skip to content

Add weekly GitHub Actions workflow to auto-update submodules via gh-powered PR#6

Open
Copilot wants to merge 17 commits into
mainfrom
copilot/add-github-actions-workflow
Open

Add weekly GitHub Actions workflow to auto-update submodules via gh-powered PR#6
Copilot wants to merge 17 commits into
mainfrom
copilot/add-github-actions-workflow

Conversation

Copilot AI commented May 14, 2026

Copy link
Copy Markdown

This adds automation for submodule maintenance so updates no longer require manual sync. A scheduled workflow now updates submodule refs and raises a pull request only when changes exist.

  • New workflow: weekly submodule update

    • Added .github/workflows/update-submodules.yaml
    • Triggers:
      • schedule (weekly, Monday 00:00 UTC)
  • Submodule refresh logic

    • Syncs submodule config and advances all submodules to latest remote commits recursively.
    • Detects changes against HEAD and commits only when updates exist.
  • Automated PR creation

    • Uses gh CLI (with GH_TOKEN) instead of peter-evans/create-pull-request.
    • Pushes updates to dedicated branch ci/update-submodules.
    • Resolves the repository default branch dynamically and creates or updates a matching open PR.
    • Includes error handling for PR lookup edge cases (including multiple matching open PRs).
    • Runs the PR creation/update step explicitly with shell: bash.
on:
  schedule:
    - cron: '0 0 * * 1'

steps:
  - uses: actions/checkout@v6
    with:
      submodules: recursive
  - run: |
      git submodule sync --recursive
      git submodule update --init --recursive --remote
  - run: |
      git checkout -B ci/update-submodules
      git commit -m "ci: update submodules"
      git push --force origin ci/update-submodules
  - shell: bash
    run: |
      gh pr list ...
      gh pr edit ... || gh pr create ...

Copilot AI changed the title [WIP] Add GitHub Actions workflow to update submodules weekly Add weekly GitHub Actions workflow to auto-update submodules via PR May 14, 2026
Copilot finished work on behalf of kou May 14, 2026 07:40
Copilot AI requested a review from kou May 14, 2026 07:40
Comment on lines +42 to +52
uses: peter-evans/create-pull-request@v7
with:
commit-message: "ci: update submodules"
title: "ci: update submodules"
body: |
## Summary
- update git submodules to their latest upstream commits

This pull request was generated automatically.
branch: ci/update-submodules
delete-branch: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@copilot Use gh instead of peter-evans/create-pull-request GitHub Action.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated in 36ff4e3: the workflow now uses gh to create/update the submodule PR (removed peter-evans/create-pull-request).

Copilot AI and others added 11 commits May 14, 2026 07:57
Copilot AI changed the title Add weekly GitHub Actions workflow to auto-update submodules via PR Add weekly GitHub Actions workflow to auto-update submodules via gh-powered PR May 14, 2026
Copilot finished work on behalf of kou May 14, 2026 08:04
Copilot AI requested a review from kou May 14, 2026 08:04
Comment thread .github/workflows/update-submodules.yaml Outdated
@kou kou marked this pull request as ready for review May 14, 2026 08:07
Copilot AI review requested due to automatic review settings May 14, 2026 08:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a GitHub Actions workflow to automate weekly/manual submodule refreshes and open or update a PR with the resulting submodule pointer changes.

Changes:

  • Adds scheduled and manual workflow triggers for submodule updates.
  • Updates submodules recursively and commits changes to ci/update-submodules.
  • Uses gh CLI to create or update the corresponding PR.

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

timeout-minutes: 10
steps:
- uses: actions/checkout@v6
with:
Comment on lines +62 to +64
env:
GH_TOKEN: ${{ github.token }}
run: |
Comment on lines +26 to +30
jobs:
update-submodules:
name: Update submodules
runs-on: ubuntu-latest
timeout-minutes: 10
Comment thread .github/workflows/update-submodules.yaml Outdated
Copilot AI review requested due to automatic review settings May 14, 2026 08:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment on lines +17 to +19
on:
schedule:
- cron: '0 0 * * 1'
Comment on lines +62 to +64
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@copilot Use shell: bash instead.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated in cb9c01d: added shell: bash to the Create or update pull request step.

Copilot finished work on behalf of kou May 14, 2026 12:02
Copilot AI requested a review from kou May 14, 2026 12:02
Comment thread .github/workflows/update-submodules.yaml Outdated
Copilot AI review requested due to automatic review settings May 14, 2026 21:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

if: steps.commit.outputs.has_changes == 'true'
shell: bash
env:
GH_TOKEN: ${{ github.token }}
fi

pr_list=""
if ! pr_list="$(gh pr list --head ci/update-submodules --base "$base_branch" --state open --json number --jq '.[].number')"; then

on:
schedule:
- cron: '0 0 * * 1'
Comment on lines +51 to +55
git checkout -B ci/update-submodules
git add .gitmodules
git submodule foreach --recursive 'git -C "$toplevel" add "$sm_path"'
git commit -m "ci: update submodules"
git push --force origin ci/update-submodules
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.

Add a GitHub Actions workflow that update submodules weekly

3 participants