From f362496fd14319a30b771fb8905c44ff24694939 Mon Sep 17 00:00:00 2001 From: Shati Patel <42641846+shati-patel@users.noreply.github.com> Date: Thu, 29 Apr 2021 18:24:30 +0100 Subject: [PATCH] Automatically update submodule pointers --- .../workflows/check-submodule-pointers.yml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/check-submodule-pointers.yml diff --git a/.github/workflows/check-submodule-pointers.yml b/.github/workflows/check-submodule-pointers.yml new file mode 100644 index 0000000..2ff7311 --- /dev/null +++ b/.github/workflows/check-submodule-pointers.yml @@ -0,0 +1,38 @@ +name: Check submodule pointers + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + check-submodules: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Check ql submodule + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + # Tip of the lgtm.com branch + target_sha=$(gh api repos/github/codeql/git/ref/heads/lgtm.com --jq '.object.sha') + + if [ $(git rev-parse @:./ql) == $target_sha ]; then + echo "The ql submodule already points to the tip of the lgtm.com branch. Nothing to do." + else + cd ql + git fetch origin $target_sha + git checkout $target_sha + cd .. + git add ql + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git commit -m "Bump ql submodule to latest lgtm.com" + git push origin $GITHUB_REF + fi +# Do similar thing for codeql-go