Check submodules #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: check-submodules | |
run-name: "Check submodules" | |
on: | |
- pull_request | |
- push | |
jobs: | |
build: | |
name: Check submodules | |
runs-on: Ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
with: | |
submodules: true | |
fetch-depth: 0 | |
# Checks that all the submodule checkouts are on a commit reachable by | |
# their branch parameter. Prevents accidentally moving the submodule to | |
# an unintentional branch without update .gitmodules also | |
- name: Check submodules branches | |
run: | | |
git submodule foreach --recursive 'BRANCH=$(git -C $toplevel config --file .gitmodules submodule.$name.branch); git merge-base --is-ancestor HEAD origin/$BRANCH || (echo "HEAD is not on origin/$BRANCH!" && exit 1)' | |
shell: bash |