Verify max one keyboard addition during CI. (#21246)
parent
c1929dc5c7
commit
ac64e06079
|
@ -36,6 +36,7 @@ jobs:
|
||||||
echo '${{ steps.file_changes.outputs.all_changed_files}}'
|
echo '${{ steps.file_changes.outputs.all_changed_files}}'
|
||||||
|
|
||||||
- name: Run qmk lint
|
- name: Run qmk lint
|
||||||
|
if: always()
|
||||||
shell: 'bash {0}'
|
shell: 'bash {0}'
|
||||||
run: |
|
run: |
|
||||||
QMK_CHANGES=$(echo -e '${{ steps.file_changes.outputs.all_changed_files}}' | sed 's/ /\n/g')
|
QMK_CHANGES=$(echo -e '${{ steps.file_changes.outputs.all_changed_files}}' | sed 's/ /\n/g')
|
||||||
|
@ -72,3 +73,32 @@ jobs:
|
||||||
exit 255
|
exit 255
|
||||||
fi
|
fi
|
||||||
exit $exit_code
|
exit $exit_code
|
||||||
|
|
||||||
|
- name: Verify at most one added keyboard
|
||||||
|
if: always()
|
||||||
|
shell: 'bash {0}'
|
||||||
|
run: |
|
||||||
|
git reset --hard
|
||||||
|
git clean -xfd
|
||||||
|
|
||||||
|
# Get the keyboard list and count for the target branch
|
||||||
|
git checkout -f ${{ github.base_ref }}
|
||||||
|
git pull --ff-only
|
||||||
|
QMK_KEYBOARDS_BASE=$(qmk list-keyboards)
|
||||||
|
QMK_KEYBOARDS_BASE_COUNT=$(qmk list-keyboards | wc -l)
|
||||||
|
|
||||||
|
# Get the keyboard list and count for the PR
|
||||||
|
git checkout -f ${{ github.head_ref }}
|
||||||
|
git merge --no-commit --squash ${{ github.base_ref }}
|
||||||
|
QMK_KEYBOARDS_PR=$(qmk list-keyboards)
|
||||||
|
QMK_KEYBOARDS_PR_COUNT=$(qmk list-keyboards | wc -l)
|
||||||
|
|
||||||
|
echo "::group::Keyboards changes in this PR"
|
||||||
|
diff -d -U 0 <(echo "$QMK_KEYBOARDS_BASE") <(echo "$QMK_KEYBOARDS_PR") | grep -vE '^(---|\+\+\+|@@)' | sed -e 's@^-@Removed: @g' -e 's@^+@ Added: @g'
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
if [[ $QMK_KEYBOARDS_PR_COUNT -gt $(($QMK_KEYBOARDS_BASE_COUNT + 1)) ]]; then
|
||||||
|
echo "More than one keyboard added in this PR -- see the PR Checklist."
|
||||||
|
echo "::error::More than one keyboard added in this PR -- see the PR Checklist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue