fix: validate workspace instead of project

Signed-off-by: Benjamin Janssens <benji.janssens@gmail.com>
This commit is contained in:
Benjamin Janssens
2024-09-04 09:40:56 +02:00
parent 7f65deff34
commit 8a36e52d42
@@ -323,12 +323,9 @@ export function createPublishBitbucketCloudPullRequestAction(options: {
gitAuthorEmail,
} = ctx.input;
const { project, repo, host, workspace } = parseRepoUrl(
repoUrl,
integrations,
);
const { workspace, repo, host } = parseRepoUrl(repoUrl, integrations);
if (!project) {
if (!workspace) {
throw new InputError(
`Invalid URL provider was included in the repo URL to create ${ctx.input.repoUrl}, missing project`,
);
@@ -350,15 +347,17 @@ export function createPublishBitbucketCloudPullRequestAction(options: {
let finalTargetBranch = targetBranch;
if (!finalTargetBranch) {
finalTargetBranch = await getDefaultBranch({
workspace: workspace!,
workspace,
repo,
authorization,
apiBaseUrl,
});
}
// TODO: check if sourceBranch already exists and just create a pull request for it if so
await createBranch({
workspace: workspace!,
workspace,
repo,
branchName: sourceBranch,
authorization,
@@ -445,7 +444,7 @@ export function createPublishBitbucketCloudPullRequestAction(options: {
});
const pullRequestUrl = await createPullRequest({
workspace: workspace!,
workspace,
repo,
title,
description,