refactor(featuredetection): remove temp in favour of early returns

Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
Babak K. Shandiz 2026-02-17 11:46:27 +00:00
parent ce016217d0
commit 52eca96873
No known key found for this signature in database
GPG key ID: 9472CAEFF56C742E

View file

@ -425,28 +425,30 @@ func (d *detector) ActionsFeatures() (ActionsFeatures, error) {
// going to be ignored/removed. So, once we are migrating to the new API version we should double check the status
// of the API.
var dispatchRunDetailsSupported bool
if !ghauth.IsEnterprise(d.host) {
dispatchRunDetailsSupported = true
} else {
minSupportedVersion, err := version.NewVersion(enterpriseWorkflowDispatchRunDetailsSupport)
if err != nil {
return ActionsFeatures{}, err
}
return ActionsFeatures{
DispatchRunDetails: true,
}, nil
}
hostVersion, err := resolveEnterpriseVersion(d.httpClient, d.host)
if err != nil {
return ActionsFeatures{}, err
}
minSupportedVersion, err := version.NewVersion(enterpriseWorkflowDispatchRunDetailsSupport)
if err != nil {
return ActionsFeatures{}, err
}
if hostVersion.GreaterThanOrEqual(minSupportedVersion) {
dispatchRunDetailsSupported = true
}
hostVersion, err := resolveEnterpriseVersion(d.httpClient, d.host)
if err != nil {
return ActionsFeatures{}, err
}
if hostVersion.GreaterThanOrEqual(minSupportedVersion) {
return ActionsFeatures{
DispatchRunDetails: true,
}, nil
}
return ActionsFeatures{
DispatchRunDetails: dispatchRunDetailsSupported,
DispatchRunDetails: false,
}, nil
}