Skip to content

Commit 0656652

Browse files
Fix stringbool conversion (#64)
* Change showModelMetadataFooter input type from boolean to stringbool * Refactor input parsing to use z.string() instead of z.coerce.string() * add INPUT_SHOW_MODEL_METADATA_FOOTER
1 parent bb681f8 commit 0656652

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

pr-review/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ INPUT_PREVIOUS_RESULTS='keep'
1818
# INPUT_DISCLAIMER_PROMPT=
1919
# INPUT_HEADER_TEXT=
2020
# INPUT_FOOTER_TEXT=
21+
# INPUT_SHOW_MODEL_METADATA_FOOTER=
2122
# INPUT_BASE_SHA=
2223
# INPUT_HEAD_SHA=
2324
# INPUT_INCLUDE_FILES=**

pr-summary/src/config.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,25 +73,25 @@ function setSecret<T>(value: T): T {
7373
*/
7474
export const config = {
7575
/** The personal access token of the GitHub user that is used to create the summary */
76-
userToken: setSecret(parseInput(z.coerce.string(), "user-token")),
76+
userToken: setSecret(parseInput(z.string(), "user-token")),
7777

7878
/** The URL for GitHub REST API */
79-
githubApiUrl: parseInput(z.coerce.string(), "github-api-url"),
79+
githubApiUrl: parseInput(z.string(), "github-api-url"),
8080

8181
/** The owner of the repository for which the summary should be created. */
82-
owner: parseInput(z.coerce.string(), "owner"),
82+
owner: parseInput(z.string(), "owner"),
8383

8484
/** The name of the repository for which the summary should be created. */
85-
repo: parseInput(z.coerce.string(), "repo"),
85+
repo: parseInput(z.string(), "repo"),
8686

8787
/** The number of the pull request for which the summary should be created. */
8888
prNumber: parseInput(z.coerce.number(), "pr-number"),
8989

9090
/** The hash of the commit representing the code before changes. Used as the starting point in comparison. */
91-
baseSha: parseInput(z.coerce.string(), "base-sha"),
91+
baseSha: parseInput(z.string(), "base-sha"),
9292

9393
/** The hash of the commit representing the code after changes. Used as the end point in comparison. */
94-
headSha: parseInput(z.coerce.string(), "head-sha"),
94+
headSha: parseInput(z.string(), "head-sha"),
9595

9696
/** The service key for your SAP AI Core service instance. */
9797
aicoreServiceKey: ((): ServiceKey => {
@@ -102,16 +102,16 @@ export const config = {
102102
})(),
103103

104104
/** A list of patterns that match the files that should be included in the summary. */
105-
includeFiles: parseInputAsArray(z.coerce.string(), "include-files"),
105+
includeFiles: parseInputAsArray(z.string(), "include-files"),
106106

107107
/** A list of patterns that match the files that should be excluded from the summary. */
108-
excludeFiles: parseInputAsArray(z.coerce.string(), "exclude-files"),
108+
excludeFiles: parseInputAsArray(z.string(), "exclude-files"),
109109

110110
/** A list of patterns for files that should always be included as context, regardless of whether the PR affects them. */
111-
includeContextFiles: parseInputAsArray(z.coerce.string(), "include-context-files"),
111+
includeContextFiles: parseInputAsArray(z.string(), "include-context-files"),
112112

113113
/** A list of patterns for files that should be excluded from context, regardless of whether the PR affects them. */
114-
excludeContextFiles: parseInputAsArray(z.coerce.string(), "exclude-context-files"),
114+
excludeContextFiles: parseInputAsArray(z.string(), "exclude-context-files"),
115115

116116
/** The name of the SAP AI Core model that is used to generate the summary. */
117117
model: parseInput(ModelName, "model"),
@@ -120,28 +120,28 @@ export const config = {
120120
modelParameters: parseInputAsJson(ModelParameters, "model-parameters"),
121121

122122
/** The version of the model that is used to generate the summary. */
123-
modelVersion: parseInput(z.coerce.string(), "model-version"),
123+
modelVersion: parseInput(z.string(), "model-version"),
124124

125125
/** The deployment configuration as JSON. For example, {"resourceGroup": "abcdefg"}. */
126126
deploymentConfig: parseInputAsJson(DeploymentConfig, "deployment-config"),
127127

128128
/** Whether to show the model metadata in the footer of the summary. */
129-
showModelMetadataFooter: parseInput(z.coerce.boolean(), "show-model-metadata-footer"),
129+
showModelMetadataFooter: parseInput(z.stringbool(), "show-model-metadata-footer"),
130130

131131
/** The base prompt that is used to generate the summary. */
132-
prompt: parseInput(z.coerce.string(), "prompt"),
132+
prompt: parseInput(z.string(), "prompt"),
133133

134134
/** The text that is placed before the summary. */
135-
headerText: parseInput(z.coerce.string(), "header-text"),
135+
headerText: parseInput(z.string(), "header-text"),
136136

137137
/** The text that is placed after the summary. */
138-
footerText: parseInput(z.coerce.string(), "footer-text"),
138+
footerText: parseInput(z.string(), "footer-text"),
139139

140140
/** The action to take with previous results. */
141141
previousResults: parseInput(z.enum(["keep", "hide", "delete"]), "previous-results"),
142142

143143
/** Additional prompt text that is added to the base prompt. */
144-
promptAddition: parseInput(z.coerce.string(), "prompt-addition"),
144+
promptAddition: parseInput(z.string(), "prompt-addition"),
145145

146146
/** Defines where the summary will be posted. */
147147
displayMode: parseInput(z.enum(["comment", "comment-delta", "append", "none"]), "display-mode"),

0 commit comments

Comments
 (0)