Skip to content

feat(autocurrency): add agent-driven currency fix loop #388

feat(autocurrency): add agent-driven currency fix loop

feat(autocurrency): add agent-driven currency fix loop #388

name: Merge Conditions
on:
pull_request:
branches: [main]
types: [opened, reopened, synchronize]
permissions:
checks: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
enforce-all-checks:
runs-on: ubuntu-latest
steps:
- name: Wait for all checks to complete
uses: actions/github-script@v7
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const sha = context.payload.pull_request.head.sha;
const self = 'enforce-all-checks';
const ignoredChecks = new Set([self]);
const ignoredPatterns = [
/^endpoint-test \/ endpoint-test/, // SageMaker endpoint tests — non-blocking
];
const intervalMs = 30_000;
const timeoutMs = 7_200_000;
const deadline = Date.now() + timeoutMs;
while (Date.now() < deadline) {
const { data } = await github.rest.checks.listForRef({ owner, repo, ref: sha, per_page: 100 });
const runs = data.check_runs.filter(r => !ignoredChecks.has(r.name) && !ignoredPatterns.some(p => p.test(r.name)));
const failed = runs.filter(r => r.status === 'completed' && r.conclusion !== 'success' && r.conclusion !== 'skipped' && r.conclusion !== 'neutral');
if (failed.length > 0) {
for (const r of failed) core.info(`❌ ${r.name}: ${r.conclusion}`);
core.setFailed('One or more check runs failed.');
return;
}
const pending = runs.filter(r => r.status !== 'completed');
if (pending.length === 0) {
core.info(`✅ All ${runs.length} check runs passed.`);
return;
}
core.info(`⏳ ${pending.length} check(s) still running...`);
await new Promise(r => setTimeout(r, intervalMs));
}
core.setFailed('Timed out waiting for check runs.');