Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions verify.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 } : {}),
Expand Down Expand Up @@ -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 } : {}),
Expand Down
8 changes: 4 additions & 4 deletions verify.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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')
})
Loading