Skip to content

Also make sure source repo installation id is there for source code subs #4696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,15 @@ public async Task<IActionResult> Create([FromBody, Required] SubscriptionData su
"The Maestro github application must be installed by the repository's owner and given access to the repository."
]));
}
// We also need to make sure the source repository is registered if the subscription is source-enabled
if (subscription.SourceEnabled ?? false && !(await EnsureRepositoryRegistration(subscription.SourceRepository)))
{
return BadRequest(new ApiError("The request is invalid",
[
$"No Maestro GitHub application installation found for repository '{subscription.SourceRepository}'. " +
"The Maestro github application must be installed by the repository's owner and given access to the repository."
]));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to do what we did in 5e4e719 and just look up the registration during the subscription creation (and fail there if there indeed is no installation present).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we don't actually need this, I added it to my local when I was running the repro tool on my new devbox and didn't have any repos in there


if (subscription.SourceEnabled.HasValue)
{
Expand Down
Loading