Tidy error messages and split up checks

This commit is contained in:
shati-patel
2021-04-29 20:50:04 +01:00
parent ac8bde0aa6
commit 54ed69d323

View File

@@ -3,23 +3,28 @@ name: Check submodule pointers
on: on:
push: push:
branches: [ main ] branches: [ main ]
pull_request:
branches: [ main ]
jobs: jobs:
check-submodules: check-submodules:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository == 'github/vscode-codeql-starter'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Compare submodule pointers to lgtm.com branch - name: Compare submodule pointers to lgtm.com branch
env: env:
GITHUB_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
if [ $(git rev-parse @:./ql) != $(gh api repos/github/codeql/git/ref/heads/lgtm.com --jq '.object.sha') ] || \ CODEQL_ACTUAL_SHA="$(git rev-parse @:./ql)"
[ $(git rev-parse @:./codeql-go) != $(gh api repos/github/codeql-go/git/ref/heads/lgtm.com --jq '.object.sha') ] CODEQL_EXPECTED_SHA="$(gh api repos/github/codeql/git/ref/heads/lgtm.com --jq '.object.sha')"
then if [ "$CODEQL_EXPECTED_SHA" != "$CODEQL_ACTUAL_SHA" ]; then
echo "Submodules are out-of-date. Please update submodule pointers to the latest lgtm.com branch." 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
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')"
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."
exit 1 exit 1
fi fi