()
| 563 | ) |
| 564 | |
| 565 | func (d *detector) ActionsFeatures() (ActionsFeatures, error) { |
| 566 | // TODO workflowDispatchRunDetailsCleanup |
| 567 | // Once GHES 3.20 support ends, we don't need feature detection for workflow dispatch (i.e. run details support). |
| 568 | // |
| 569 | // On github.com, workflow dispatch API now supports a new field named `return_run_details` that enabling it will |
| 570 | // result in a 200 OK response with the details of the created workflow run. If not set (or set to false), the API |
| 571 | // will keep the old behavior of returning a 204 No Content response. |
| 572 | // |
| 573 | // On GHES (current latest at 3.20), this new field is not available, and setting it will cause a 400 response. |
| 574 | // |
| 575 | // Once GHES 3.20 support ends, we can remove the feature detection and start using the new field in API calls. |
| 576 | // |
| 577 | // IMPORTANT: In the future REST API versions (i.e. breaking changes), the workflow dispatch endpoint is going to |
| 578 | // always return the details of the created workflow run in the response, and the `return_run_details` field is |
| 579 | // going to be ignored/removed. So, once we are migrating to the new API version we should double check the status |
| 580 | // of the API. |
| 581 | |
| 582 | if !ghauth.IsEnterprise(d.host) { |
| 583 | return ActionsFeatures{ |
| 584 | DispatchRunDetails: true, |
| 585 | }, nil |
| 586 | } |
| 587 | |
| 588 | minSupportedVersion, err := version.NewVersion(enterpriseWorkflowDispatchRunDetailsSupport) |
| 589 | if err != nil { |
| 590 | return ActionsFeatures{}, err |
| 591 | } |
| 592 | |
| 593 | hostVersion, err := resolveEnterpriseVersion(d.client(), d.host) |
| 594 | if err != nil { |
| 595 | return ActionsFeatures{}, err |
| 596 | } |
| 597 | |
| 598 | if hostVersion.GreaterThanOrEqual(minSupportedVersion) { |
| 599 | return ActionsFeatures{ |
| 600 | DispatchRunDetails: true, |
| 601 | }, nil |
| 602 | } |
| 603 | |
| 604 | return ActionsFeatures{ |
| 605 | DispatchRunDetails: false, |
| 606 | }, nil |
| 607 | } |
| 608 | |
| 609 | // AuthFeatures checks the unauthenticated meta endpoint for GHES support. |
| 610 | func (d *detector) AuthFeatures() (AuthFeatures, error) { |
nothing calls this directly
no test coverage detected