diff --git a/.github/workflows/check-submodules.yml b/.github/workflows/check-submodules.yml new file mode 100644 index 0000000000000000000000000000000000000000..6ffc328addc39165d34db082bf1c347cd9319eb5 --- /dev/null +++ b/.github/workflows/check-submodules.yml @@ -0,0 +1,28 @@ +name: Update submodules + +on: + schedule: + # - cron: '0 2 * * 0' # run at 2 AM every sunday + - cron: '5 4 2 * *' # 04:05 every 2nd of month + push: + branches: [ 'ci/auto-update-submodules' ] + +jobs: + update_submodules: + runs-on: ubuntu-latest + steps: + - name: Clone w/ submodules + uses: actions/checkout@v2 + with: + submodules: recursive + fetch-depth: 0 + - name: Check submodules for updates + run: scripts/submodule-diff.sh + - name: Create Issue From File + uses: peter-evans/create-issue-from-file@v3 + with: + title: '[AUTOMATED] Git submodule updates found' + content-filepath: ./diff.log + labels: | + dependency update + assignees: brenthuisman diff --git a/.gitmodules b/.gitmodules index 7a46b5b6354ac9af35b6e06d185f3898080dd21e..524236170b84329a3fb9ca4dec0f04661d7eb1f8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,12 @@ [submodule "google-benchmark"] path = ext/google-benchmark url = https://github.com/google/benchmark + branch = main [submodule "python/pybind11"] path = python/pybind11 url = https://github.com/pybind/pybind11.git + branch = master [submodule "ext/fmt"] path = ext/fmt url = https://github.com/fmtlib/fmt.git + branch = master diff --git a/scripts/submodule-diff.sh b/scripts/submodule-diff.sh new file mode 100755 index 0000000000000000000000000000000000000000..b056895c9faa4edf21c140bbe5c2d7f3e3c60c3d --- /dev/null +++ b/scripts/submodule-diff.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# Check any git submodule remotes for updates, and print difference with current Arbor repo state to `diff.log` + +git submodule foreach 'git describe HEAD --tags' | tee current_state_of_git_submodules_in_arbor_repo.log +git submodule foreach 'git fetch' +git submodule foreach 'git describe `git log --branches -1 --pretty=format:"%H"` --tags --abbrev=0' | tee upstream_state_of_git_submodules.log +if diff current_state_of_git_submodules_in_arbor_repo.log upstream_state_of_git_submodules.log ; then + echo "No submodule updates found" +else + diff current_state_of_git_submodules_in_arbor_repo.log upstream_state_of_git_submodules.log -U 10000 > diff.log +fi +rm current_state_of_git_submodules_in_arbor_repo.log +rm upstream_state_of_git_submodules.log