From 95145b3d67509c9e4f1b07882b93229041458040 Mon Sep 17 00:00:00 2001 From: Jonathan Davies Date: Wed, 21 Oct 2026 08:58:16 -0700 Subject: [PATCH] Fix repository selection for shared Verify projects --- verify.mjs | 6 +++--- verify.test.mjs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/verify.mjs b/verify.mjs index 2d0dc68..8f76e82 100644 --- a/verify.mjs +++ b/verify.mjs @@ -76,7 +76,7 @@ export function configuration(inputs, event, context) { token: inputs.token, org: inputs.org, project: inputs.project, - ...(context.provider === 'gitlab' ? { repository: inputs.repository } : {}), + repository: context.provider === 'gitlab' ? inputs.repository : context.repository, branch, number, sha, @@ -146,7 +146,7 @@ export async function verify( } } const pr = await api(requests, { - ...(config.provider === 'gitlab' ? { repository_id: config.repository } : {}), + repository_id: config.repository, ...(config.number ? { number: config.number } : {}), head_sha: config.sha, ...(config.project ? { project_id: config.project } : {}), @@ -190,7 +190,7 @@ export async function verify( if (!pr.requested_run_id) return outputs // Registered branch preview, draft or closed PR. if (config.previewUrl || config.environment) { const run = await api(`${requests}/preview`, { - ...(config.provider === 'gitlab' ? { repository_id: config.repository } : {}), + repository_id: config.repository, number: pr.number || config.number, head_sha: config.sha, ...(config.project ? { project_id: config.project } : {}), diff --git a/verify.test.mjs b/verify.test.mjs index 4cb8af1..3e5d3ac 100644 --- a/verify.test.mjs +++ b/verify.test.mjs @@ -52,7 +52,7 @@ test('infers PR head rather than GitHub merge SHA and uses stable retry keys', ( assert.equal(first.number, 45) assert.equal(first.sha, sha) assert.equal(first.project, 'storefront') - assert.equal(first.repository, undefined) + assert.equal(first.repository, 'example/shop') assert.equal(first.branch, 'fix/checkout') assert.equal(first.key, config().key) assert.notEqual( @@ -202,10 +202,10 @@ test('hands a deployed URL to the exact request, waits, and publishes the groupe assert.equal(api.calls[0].body.head_sha, sha) assert.equal(api.calls[0].body.number, 45) assert.equal(api.calls[0].body.project_id, 'storefront') - assert.equal('repository_id' in api.calls[0].body, false) + assert.equal(api.calls[0].body.repository_id, 'example/shop') assert.equal(api.calls[0].body.branch, 'fix/checkout') assert.equal(api.calls[1].body.project_id, 'storefront') - assert.equal('repository_id' in api.calls[1].body, false) + assert.equal(api.calls[1].body.repository_id, 'example/shop') assert.equal(api.calls[1].body.branch, 'fix/checkout') assert.equal(api.calls[1].body.preview_url, 'https://pr-45.preview.test') assert.equal(api.calls[1].body.head_sha, sha) @@ -368,5 +368,5 @@ test('entrypoint reads Actions inputs, writes outputs and summary, and masks the test('requires a Composal project and never infers it from a GitHub repository', () => { assert.throws(() => config({ project: '' }), /Set project/) assert.equal(config({ repository: 'ignored-repository' }).project, 'storefront') - assert.equal(config({ repository: 'ignored-repository' }).repository, undefined) + assert.equal(config({ repository: 'ignored-repository' }).repository, 'example/shop') })