Skip to content

Commit f74b525

Browse files
committed
ci(cleanup): name only this PR's script in the checkout comment
The checkout comment named scripts/ci/aws-error.sh and scripts/ci/rest-api-quota.sh, which come with #959. This PR now merges first, so on main only scripts/ci/amplify-stuck-delete.sh exists; #959 names its scripts again when it rebases. A test now pins what the Amplify step needs from that checkout: it runs on every leg and includes scripts/ci. Restoring main's checkout (e2e legs only, no scripts/ci) fails it.
1 parent e11d03b commit f74b525

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎.github/workflows/cleanup-stacks.yml‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ jobs:
6161
include: ${{ fromJSON(needs.legs.outputs.matrix) }}
6262
environment: ${{ matrix.environment }}
6363
steps:
64-
# The steps below source scripts/ci/aws-error.sh, the REST API sweep runs
65-
# scripts/ci/rest-api-quota.sh and the Amplify sweep runs
66-
# scripts/ci/amplify-stuck-delete.sh.
64+
# Every leg: the Amplify sweep runs scripts/ci/amplify-stuck-delete.sh.
6765
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
6866
with:
6967
sparse-checkout: |

‎scripts/ci/amplify-stuck-delete.test.mjs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,4 +822,17 @@ describe('cleanup-stacks.yml checkout', () => {
822822
const comment = lines.slice(at - 3, at).join('\n');
823823
assert.match(comment, /amplify-stuck-delete\.sh/);
824824
});
825+
826+
// The Amplify step runs on every leg, so the script must be there on each.
827+
it('checks out scripts/ci on every leg', () => {
828+
const lines = readFileSync(WORKFLOW, 'utf8').split('\n');
829+
const at = lines.findIndex((l, i) => i > lines.indexOf(' cleanup:') && l.trim().startsWith('- uses: actions/checkout@'));
830+
const step = [];
831+
for (const line of lines.slice(at + 1)) {
832+
if (line.trim().startsWith('- ')) break;
833+
step.push(line.trim());
834+
}
835+
assert.ok(!step.some((l) => l.startsWith('if:')), 'the checkout must run on every leg');
836+
assert.ok(step.includes('scripts/ci'), 'sparse-checkout must include scripts/ci');
837+
});
825838
});

0 commit comments

Comments
 (0)