From d44e61eb0b435d42f522b5b3529648d9f188fbaf Mon Sep 17 00:00:00 2001 From: hassayag Date: Tue, 21 Jul 2026 16:57:47 +0100 Subject: [PATCH 1/8] ci: check commit shas before doing expensive git pulls --- .github/workflows/auto-deploy.yaml | 80 ++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 22 deletions(-) diff --git a/.github/workflows/auto-deploy.yaml b/.github/workflows/auto-deploy.yaml index 81daabbc..f2621fa3 100644 --- a/.github/workflows/auto-deploy.yaml +++ b/.github/workflows/auto-deploy.yaml @@ -2,7 +2,7 @@ name: Auto Deploy on: schedule: - - cron: '23 * * * *' + - cron: '*/5 * * * *' workflow_dispatch: inputs: @@ -10,24 +10,47 @@ on: type: boolean description: Only parse English localizations default: false - force: type: boolean description: Run deployments even if version has not changed default: false jobs: - check-update: - name: Check for new version + check-commit: + name: Check for new commit to SteamDB repo runs-on: ubuntu-latest outputs: - new_version: ${{ steps.check_version.outputs.new_version }} + changed: ${{ steps.compare.outputs.changed }} + latest_commit_sha: ${{ steps.remote_shas.outputs.steamdb_sha }} steps: - name: Checkout Deadbot repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 + + - name: Get latest remote commit hashes + id: remote_shas + run: | + steamdb_sha=$(git ls-remote https://github.com/SteamDatabase/GameTracking-Deadlock.git HEAD | cut -f1) + echo "steamdb_sha=$steamdb_sha" >> "$GITHUB_OUTPUT" + + - name: Compare against last known commits + id: compare + run: | + if [ "${{ steps.remote_shas.outputs.steamdb_sha }}" != "${{ vars.LAST_STEAMDB_SHA }}" ]; then + echo "changed=true" >> "$GITHUB_OUTPUT" + else + echo "changed=false" >> "$GITHUB_OUTPUT" + fi + check-version: + name: Check if deadlock version changed + runs-on: ubuntu-latest + needs: check-commit + if: ${{ needs.check-commit.outputs.changed == 'true' || github.event.inputs.force == 'true' }} + outputs: + new_version: ${{ steps.check_version.outputs.new_version }} + steps: - name: Cache SteamDB repo - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: steamdb key: steamdb @@ -35,16 +58,17 @@ jobs: - name: Update SteamDB repo run: | - if [ -d steamdb ]; then + if [ -d steamdb/.git ]; then cd steamdb - git reset --hard - git pull + git fetch --depth 1 origin + git reset --hard origin/HEAD else - git clone https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/SteamDatabase/GameTracking-Deadlock.git steamdb + rm -rf steamdb + git clone --depth 1 https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/SteamDatabase/GameTracking-Deadlock.git steamdb fi - name: Cache deadlock-data repo - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: deadlock-data key: deadlock-data @@ -52,12 +76,13 @@ jobs: - name: Update deadlock-data repo run: | - if [ -d deadlock-data ]; then + if [ -d deadlock-data/.git ]; then cd deadlock-data - git reset --hard - git pull + git fetch --depth 1 origin + git reset --hard origin/HEAD else - git clone https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/deadlock-wiki/deadlock-data.git deadlock-data + rm -rf deadlock-data + git clone --depth 1 https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/deadlock-wiki/deadlock-data.git deadlock-data fi - name: Check for new Deadlock version @@ -65,12 +90,12 @@ jobs: run: | chmod +x ./.github/workflows/scripts/check_for_update.sh new_version=$(./.github/workflows/scripts/check_for_update.sh './steamdb' './deadlock-data') - echo "new_version=$new_version" >> $GITHUB_OUTPUT + echo "new_version=$new_version" >> "$GITHUB_OUTPUT" deploy-develop: name: Deploy develop - needs: check-update - if: ${{ needs.check-update.outputs.new_version || github.event.inputs.force == 'true' }} + needs: check-version + if: ${{ needs.check-version.outputs.new_version || github.event.inputs.force == 'true' }} uses: ./.github/workflows/deploy.yaml with: branch-override: develop @@ -80,11 +105,11 @@ jobs: STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }} STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }} BOT_WIKI_PASS: ${{ secrets.BOT_WIKI_PASS }} - + deploy-master: name: Deploy master - needs: check-update - if: ${{ needs.check-update.outputs.new_version || github.event.inputs.force == 'true' }} + needs: check-version + if: ${{ needs.check-version.outputs.new_version || github.event.inputs.force == 'true' }} uses: ./.github/workflows/deploy.yaml with: branch-override: master @@ -94,3 +119,14 @@ jobs: STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }} STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }} BOT_WIKI_PASS: ${{ secrets.BOT_WIKI_PASS }} + + save-variables: + name: Save variables for next run + runs-on: ubuntu-latest + needs: [check-commit, deploy-develop, deploy-master] + steps: + - name: Save latest SteamDB commit sha as a repo variable + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + gh variable set LAST_STEAMDB_SHA -b "${{ needs.check-commit.outputs.latest_commit_sha }}" \ No newline at end of file From 2f7bbd6e3eab1ff3476ec836472e725735cc77e7 Mon Sep 17 00:00:00 2001 From: hassayag Date: Tue, 21 Jul 2026 17:04:36 +0100 Subject: [PATCH 2/8] fix: put back deadbot repo checkout --- .github/workflows/auto-deploy.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-deploy.yaml b/.github/workflows/auto-deploy.yaml index f2621fa3..8f0aa6f2 100644 --- a/.github/workflows/auto-deploy.yaml +++ b/.github/workflows/auto-deploy.yaml @@ -23,9 +23,6 @@ jobs: changed: ${{ steps.compare.outputs.changed }} latest_commit_sha: ${{ steps.remote_shas.outputs.steamdb_sha }} steps: - - name: Checkout Deadbot repo - uses: actions/checkout@v6 - - name: Get latest remote commit hashes id: remote_shas run: | @@ -49,6 +46,9 @@ jobs: outputs: new_version: ${{ steps.check_version.outputs.new_version }} steps: + - name: Checkout Deadbot repo + uses: actions/checkout@v6 + - name: Cache SteamDB repo uses: actions/cache@v6 with: From a06914a8fc4822f69e3cd6e08db93caf2757bbf2 Mon Sep 17 00:00:00 2001 From: hassayag Date: Tue, 21 Jul 2026 17:08:06 +0100 Subject: [PATCH 3/8] ci: fixed saving variables when deploys dont run --- .github/workflows/auto-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-deploy.yaml b/.github/workflows/auto-deploy.yaml index 8f0aa6f2..0c27cc4c 100644 --- a/.github/workflows/auto-deploy.yaml +++ b/.github/workflows/auto-deploy.yaml @@ -123,7 +123,7 @@ jobs: save-variables: name: Save variables for next run runs-on: ubuntu-latest - needs: [check-commit, deploy-develop, deploy-master] + needs: [check-commit] steps: - name: Save latest SteamDB commit sha as a repo variable env: From a44cb82cd5248e038897cb14b7b85089dbd1e2eb Mon Sep 17 00:00:00 2001 From: hassayag Date: Tue, 21 Jul 2026 17:11:45 +0100 Subject: [PATCH 4/8] ci: ensure variables saved if deploys skip --- .github/workflows/auto-deploy.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto-deploy.yaml b/.github/workflows/auto-deploy.yaml index 0c27cc4c..87585014 100644 --- a/.github/workflows/auto-deploy.yaml +++ b/.github/workflows/auto-deploy.yaml @@ -123,7 +123,15 @@ jobs: save-variables: name: Save variables for next run runs-on: ubuntu-latest - needs: [check-commit] + needs: [check-commit, deploy-develop, deploy-master] + if: >- + ${{ + always() && + needs.deploy-develop.result != 'failure' && + needs.deploy-develop.result != 'cancelled' && + needs.deploy-master.result != 'failure' && + needs.deploy-master.result != 'cancelled' + }} steps: - name: Save latest SteamDB commit sha as a repo variable env: From 11a1cd9687cb94e8db6709989388be2f8b0f2f0a Mon Sep 17 00:00:00 2001 From: hassayag Date: Tue, 21 Jul 2026 17:14:05 +0100 Subject: [PATCH 5/8] ci: checkout repo to allow variable save --- .github/workflows/auto-deploy.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/auto-deploy.yaml b/.github/workflows/auto-deploy.yaml index 87585014..0d8959ba 100644 --- a/.github/workflows/auto-deploy.yaml +++ b/.github/workflows/auto-deploy.yaml @@ -133,6 +133,9 @@ jobs: needs.deploy-master.result != 'cancelled' }} steps: + - name: Checkout Deadbot repo + uses: actions/checkout@v6 + - name: Save latest SteamDB commit sha as a repo variable env: GH_TOKEN: ${{ secrets.GH_TOKEN }} From be12df067de93359fdf7feb5a96b9fdcfc0c55df Mon Sep 17 00:00:00 2001 From: hassayag Date: Tue, 21 Jul 2026 17:17:09 +0100 Subject: [PATCH 6/8] ci: only save variable if it has changed --- .github/workflows/auto-deploy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto-deploy.yaml b/.github/workflows/auto-deploy.yaml index 0d8959ba..0b59ca8e 100644 --- a/.github/workflows/auto-deploy.yaml +++ b/.github/workflows/auto-deploy.yaml @@ -127,6 +127,7 @@ jobs: if: >- ${{ always() && + needs.check-commit.outputs.changed && needs.deploy-develop.result != 'failure' && needs.deploy-develop.result != 'cancelled' && needs.deploy-master.result != 'failure' && From 0d2d11425f8522082347acd7f0f44193f8b73e9d Mon Sep 17 00:00:00 2001 From: hassayag Date: Tue, 21 Jul 2026 17:18:15 +0100 Subject: [PATCH 7/8] fix: check string 'true' --- .github/workflows/auto-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-deploy.yaml b/.github/workflows/auto-deploy.yaml index 0b59ca8e..538e6454 100644 --- a/.github/workflows/auto-deploy.yaml +++ b/.github/workflows/auto-deploy.yaml @@ -127,7 +127,7 @@ jobs: if: >- ${{ always() && - needs.check-commit.outputs.changed && + needs.check-commit.outputs.changed == 'true' && needs.deploy-develop.result != 'failure' && needs.deploy-develop.result != 'cancelled' && needs.deploy-master.result != 'failure' && From c35e9d185c768bac551971fd285f72717c5933ff Mon Sep 17 00:00:00 2001 From: hassayag Date: Wed, 22 Jul 2026 11:38:51 +0100 Subject: [PATCH 8/8] chore: new line --- .github/workflows/auto-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-deploy.yaml b/.github/workflows/auto-deploy.yaml index 538e6454..9cb21dc8 100644 --- a/.github/workflows/auto-deploy.yaml +++ b/.github/workflows/auto-deploy.yaml @@ -141,4 +141,4 @@ jobs: env: GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | - gh variable set LAST_STEAMDB_SHA -b "${{ needs.check-commit.outputs.latest_commit_sha }}" \ No newline at end of file + gh variable set LAST_STEAMDB_SHA -b "${{ needs.check-commit.outputs.latest_commit_sha }}"