From 655843e42b198cbe67600ba0c4ed7e0a6041ba74 Mon Sep 17 00:00:00 2001 From: peptiderepo <273788462+peptiderepo@users.noreply.github.com> Date: Tue, 9 Jun 2026 14:15:28 +0700 Subject: [PATCH] ci(monitor): drop false drift alerts (#7) 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 Co-authored-by: peptiderepo --- .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) {