Skip to content

Commit 35fe2a7

Browse files
committed
update additionalProps
1 parent 0765fba commit 35fe2a7

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

components/vercel_token_auth/actions/create-deployment/create-deployment.mjs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,39 +32,41 @@ export default {
3232
optional: false,
3333
reloadProps: true,
3434
},
35+
branch: {
36+
type: "string",
37+
label: "Branch",
38+
description: "Branch of repository to deploy to",
39+
},
3540
public: {
3641
type: "boolean",
3742
label: "Public",
3843
description: "Whether a deployment's source and logs are available publicly",
3944
optional: true,
4045
},
4146
},
42-
async additionalProps() {
43-
const props = {};
44-
47+
async additionalProps(props) {
4548
if (!this.project) {
46-
return props;
49+
return {};
4750
}
48-
49-
props.branch = {
50-
type: "string",
51-
label: "Branch",
52-
description: "Branch of repository to deploy to",
53-
default: "main",
54-
};
55-
5651
try {
5752
const { link } = await this.vercelTokenAuth.getProject(this.project);
5853
if (link) {
5954
props.branch.description = `Branch of \`${link.repo}\` repository to deploy to`;
6055
props.branch.default = link?.productionBranch || "main";
56+
} else {
57+
props.branch.default = "main";
6158
}
62-
return props;
6359
} catch {
64-
return props;
60+
props.branch.default = "main";
61+
return {};
6562
}
63+
return {};
6664
},
6765
async run({ $ }) {
66+
if (!this.branch) {
67+
throw new ConfigurationError("Branch prop is required");
68+
}
69+
6870
const { link } = await this.vercelTokenAuth.getProject(this.project, $);
6971
if (!link?.repoId) {
7072
throw new ConfigurationError(`No linked repository found for project with ID: ${this.project}`);

0 commit comments

Comments
 (0)