mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-13 01:45:43 +00:00
43 lines
1.2 KiB
YAML
43 lines
1.2 KiB
YAML
name: 'Submodules'
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
- main
|
|
tags:
|
|
- '*'
|
|
pull_request:
|
|
|
|
jobs:
|
|
submodules:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: 'Checkout code'
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
- name: 'Check protobuf branch'
|
|
run: |
|
|
git submodule update --init
|
|
SUB_PATH="assets/protobuf";
|
|
SUB_BRANCH="dev";
|
|
SUB_COMMITS_MIN=40;
|
|
cd "$SUB_PATH";
|
|
SUBMODULE_HASH="$(git rev-parse HEAD)";
|
|
BRANCHES=$(git branch -r --contains "$SUBMODULE_HASH");
|
|
COMMITS_IN_BRANCH="$(git rev-list --count dev)";
|
|
if [ $COMMITS_IN_BRANCH -lt $SUB_COMMITS_MIN ]; then
|
|
echo "name=fails::error" >> $GITHUB_OUTPUT
|
|
echo "::error::Error: Too low commits in $SUB_BRANCH of submodule $SUB_PATH: $COMMITS_IN_BRANCH(expected $SUB_COMMITS_MIN+)";
|
|
exit 1;
|
|
fi
|
|
if ! grep -q "/$SUB_BRANCH" <<< "$BRANCHES"; then
|
|
echo "name=fails::error" >> $GITHUB_OUTPUT
|
|
echo "::error::Error: Submodule $SUB_PATH is not on branch $SUB_BRANCH";
|
|
exit 1;
|
|
fi
|