Update workflow that checks submodules

This commit is contained in:
Shati Patel
2021-06-22 13:52:40 +00:00
committed by GitHub
parent d0127df7cd
commit 2bf16fe8eb

View File

@@ -4,6 +4,8 @@ on:
workflow_dispatch: workflow_dispatch:
push: push:
branches: [ main ] branches: [ main ]
pull_request:
branches: [ main ]
schedule: schedule:
- cron: '42 12 * * *' - cron: '42 12 * * *'
@@ -20,6 +22,7 @@ jobs:
run: | run: |
CODEQL_ACTUAL_SHA="$(git rev-parse @:./ql)" CODEQL_ACTUAL_SHA="$(git rev-parse @:./ql)"
CODEQL_EXPECTED_SHA="$(gh api repos/github/codeql/git/ref/heads/lgtm.com --jq '.object.sha')" 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 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." 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 exit 1
@@ -27,6 +30,7 @@ jobs:
CODEQL_GO_ACTUAL_SHA="$(git rev-parse @:./codeql-go)" CODEQL_GO_ACTUAL_SHA="$(git rev-parse @:./codeql-go)"
CODEQL_GO_EXPECTED_SHA="$(gh api repos/github/codeql-go/git/ref/heads/lgtm.com --jq '.object.sha')" CODEQL_GO_EXPECTED_SHA="$(gh api repos/github/codeql-go/git/ref/heads/lgtm.com --jq '.object.sha')"
echo "The codeql-go submodule currently points to $CODEQL_GO_ACTUAL_SHA. The tip of the lgtm.com branch of github/codeql-go is $CODEQL_GO_EXPECTED_SHA."
if [ "$CODEQL_GO_EXPECTED_SHA" != "$CODEQL_GO_ACTUAL_SHA" ]; then if [ "$CODEQL_GO_EXPECTED_SHA" != "$CODEQL_GO_ACTUAL_SHA" ]; then
echo "::error:: The codeql-go submodule is out of date with the lgtm.com branch of github/codeql-go. Expected $CODEQL_GO_EXPECTED_SHA, found $CODEQL_GO_ACTUAL_SHA." echo "::error:: The codeql-go submodule is out of date with the lgtm.com branch of github/codeql-go. Expected $CODEQL_GO_EXPECTED_SHA, found $CODEQL_GO_ACTUAL_SHA."
exit 1 exit 1