From b1685d239ed2c83359bb9d7e08d9d2e7bb45ea46 Mon Sep 17 00:00:00 2001 From: peptiderepo Date: Tue, 9 Jun 2026 07:15:24 +0000 Subject: [PATCH] ci(monitor): only flag drift when undeployed commits touch deployable files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compare prod-deployment SHA to main and ignore changes confined to .github/, tests/, and docs/build files (which the deploy excludes) — so infra-only commits don't trip a false 'prod behind main' alert every day. Agent-Session: cto monitor-drift-filter --- .github/workflows/deploy-health.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-health.yml b/.github/workflows/deploy-health.yml index 1862fd4..3375630 100644 --- a/.github/workflows/deploy-health.yml +++ b/.github/workflows/deploy-health.yml @@ -45,7 +45,23 @@ jobs: if (sts.length) prodState = sts[0].state; } if (runConc === 'failure') problems.push(`**${repo}**: latest deploy run failed (\`${short(runSha)}\`)`); - if (prodSha && prodSha !== main) problems.push(`**${repo}**: prod behind main — prod=\`${short(prodSha)}\` vs main=\`${short(main)}\` (undeployed commits)`); + if (prodSha && prodSha !== main) { + // Only real drift if undeployed commits touch DEPLOYABLE files + // (ignore .github/, tests/, and docs/build files the deploy excludes). + try { + const cmp = (await github.rest.repos.compareCommits({owner, repo, base: prodSha, head: main})).data; + const deployable = (cmp.files || []).some(f => { + const x = f.filename; + if (x.startsWith('.github/') || x.startsWith('tests/')) return false; + if (/^(ARCHITECTURE|CONVENTIONS|CHANGELOG|README)\.md$/.test(x)) return false; + if (/^(composer\.(json|lock)|phpunit\.xml(\.dist)?|\.?phpcs\.xml\.dist)$/.test(x)) return false; + return true; + }); + if (deployable) problems.push(`**${repo}**: prod behind main — prod=\`${short(prodSha)}\` vs main=\`${short(main)}\` (undeployed code changes)`); + } catch (e) { + problems.push(`**${repo}**: prod sha != main sha (could not diff: ${e.message})`); + } + } if (prodSha && prodState !== 'success') problems.push(`**${repo}**: last production deployment state is \`${prodState}\``); core.info(`${repo}: main=${short(main)} lastRun=${runConc} prodDeploy=${short(prodSha)}/${prodState}`); } catch (e) { -- 2.49.1