Detect schema changes #148
This file contains hidden or 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: Detect schema changes | |
| on: | |
| schedule: | |
| # run on the Tue of the second week (8th-14th) of every month, at 3:42AM | |
| - cron: '42 3 8-14 * 2' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| update-submodules: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update submodules | |
| run: | | |
| git submodule update --remote --recursive | |
| - name: Detect changes | |
| id: diff | |
| run: | | |
| changes="$( | |
| git --no-pager diff --no-color --submodule=diff | { | |
| grep -E '^diff .*/src/schemas/json/github-(workflow|action).json$' || true | |
| } | |
| )" | |
| if [[ -n "$changes" ]]; then | |
| echo "There are changes in submodules" | |
| echo "$changes" | |
| exit 1 | |
| fi |