fix: allow expressions in GitHub comment repository#3227
fix: allow expressions in GitHub comment repository#3227hadzija7 wants to merge 2 commits intosuperplanehq:mainfrom
Conversation
Skip setup-time repository installation validation for templated repository values in github.createIssueComment so expression-based workflows can be configured successfully. Signed-off-by: hadzija7 <[email protected]> Co-authored-by: Cursor <[email protected]>
df04599 to
877453a
Compare
| // Repository can be expression-based (resolved at runtime), so skip | ||
| // setup-time installation validation for templated values. | ||
| if strings.Contains(config.Repository, "{{") { | ||
| return nil | ||
| } | ||
|
|
There was a problem hiding this comment.
The reported bug happens inside ensureRepoInMetadata. Let's remove it from here and add a expression regex validation in ensureRepoInMetadata.
an example of regex validation is in https://github.com/hadzija7/superplane/blob/877453ab3b05df459af120d7fb9c9e60a2c9f67b/pkg/configuration/validation.go#L262
If hasExpressions -> ignore the check.
Note: I noticed we are doing the same thing in bitbucket
Move expression-aware repository validation into ensureRepoInMetadata so GitHub components consistently skip installation access checks for templated repository values. Signed-off-by: hadzija7 <[email protected]> Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on March 12
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| "github.com/superplanehq/superplane/pkg/crypto" | ||
| ) | ||
|
|
||
| var expressionPlaceholderRegex = regexp.MustCompile(`(?s)\{\{.*?\}\}`) |
There was a problem hiding this comment.
Duplicated regex variable across three packages
Low Severity
The expressionPlaceholderRegex variable is now duplicated in three separate packages: pkg/configuration/validation.go, pkg/integrations/sendgrid/create_or_update_contact.go, and the newly added one in pkg/integrations/github/common.go. All three use the identical pattern. This increases the risk of inconsistency if the expression syntax evolves. Extracting this into a shared, exported location would be cleaner.
There was a problem hiding this comment.
could maybe refactor this in a separate PR? @forestileao


Summary
github.createIssueCommentwhenrepositoryis an expression templaterepositoryconfigurationWhy
github.createIssueCommentfails setup withrepository ... is not accessible to app installationwhen configured with expression valuesTest plan
repository expression skips setup validation