Check submodule pointers #18
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 submodule pointers | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
types: | |
- opened | |
- synchronize | |
- ready_for_review | |
- reopened | |
schedule: | |
- cron: '42 12 * * *' | |
jobs: | |
check-submodules: | |
runs-on: ubuntu-latest | |
if: github.repository == 'github/vscode-codeql-starter' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Compare submodule pointers to lgtm.com branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
CODEQL_ACTUAL_SHA="$(git rev-parse @:./ql)" | |
CODEQL_EXPECTED_SHA="$(gh api repos/github/codeql/git/ref/heads/lgtm.com --jq '.object.sha')" | |
echo "The ql submodule currently points to $CODEQL_ACTUAL_SHA. The tip of the lgtm.com branch of github/codeql is $CODEQL_EXPECTED_SHA." | |
if [ "$CODEQL_EXPECTED_SHA" != "$CODEQL_ACTUAL_SHA" ]; then | |
echo "::error:: The ql submodule is out of date with the lgtm.com branch of github/codeql. Expected $CODEQL_EXPECTED_SHA, found $CODEQL_ACTUAL_SHA." | |
exit 1 | |
fi |