Skip to content

Commit 98b1d04

Browse files
Copilotcameri
andauthored
fix(ci): handle skipped publish prerequisites
Co-authored-by: cameri <378886+cameri@users.noreply.github.com>
1 parent 3c617ee commit 98b1d04

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

‎.github/workflows/checks.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,14 @@ jobs:
217217
- test-units-and-cover
218218
- test-integrations-and-cover
219219
- post-tests
220-
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.post-tests.result == 'success'
220+
if: >-
221+
always() && github.event_name == 'push' && github.ref == 'refs/heads/main' &&
222+
(needs.changes.result == 'success' || needs.changes.result == 'skipped') &&
223+
(needs.lint.result == 'success' || needs.lint.result == 'skipped') &&
224+
(needs.build-check.result == 'success' || needs.build-check.result == 'skipped') &&
225+
(needs.test-units-and-cover.result == 'success' || needs.test-units-and-cover.result == 'skipped') &&
226+
(needs.test-integrations-and-cover.result == 'success' || needs.test-integrations-and-cover.result == 'skipped') &&
227+
needs.post-tests.result == 'success'
221228
env:
222229
REGISTRY: ghcr.io
223230
IMAGE_NAME: ${{ github.repository }}

‎test/unit/ci/publish-container-image.spec.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ describe('container image publishing workflow', () => {
2424
'test-integrations-and-cover',
2525
'post-tests',
2626
])
27-
expect(publish.if).to.equal(
28-
"github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.post-tests.result == 'success'",
29-
)
27+
expect(publish.if).to.include("always() && github.event_name == 'push' && github.ref == 'refs/heads/main'")
28+
for (const job of publish.needs.filter((job) => job !== 'post-tests')) {
29+
expect(publish.if).to.include(`needs.${job}.result == 'success' || needs.${job}.result == 'skipped'`)
30+
}
31+
expect(publish.if).to.include("needs.post-tests.result == 'success'")
3032
expect(existsSync(join(process.cwd(), '.github', 'workflows', 'publish-container-image.yml'))).to.equal(false)
3133
})
3234
})

0 commit comments

Comments
 (0)