minder icon indicating copy to clipboard operation
minder copied to clipboard

Provide better error message when branch protection API are disabled

Open blkt opened this issue 1 year ago • 0 comments

In case a repository is configured with Branch Protection API disabled, any remediation action will fail giving an ugly error message (see "404 branch protection has been disabled" message).

      entity: repository
      entityInfo:
        provider: github-app-blkt
        repo_name: demo-repo-python
        repo_owner: blkt
        repository_id: cbad8277-cf35-431c-a92f-48be2d3e8c5a
      profileId: 4d59b709-d3d7-417c-8086-dc0b79034be4
      remediationDetails: 'error getting branch protection: error getting branch protection: GET https://api.github.com/repos/blkt/demo-repo-python/branches/main/protection: 404 Branch protection has been disabled on this reposito>
      remediationStatus: error
      ruleDescriptionName: branch_protection_allow_force_pushes
      ruleId: 6a29d6fe-73c7-4d2d-b8d1-fa0517366d65
      ruleName: branch_protection_allow_force_pushes
      ruleTypeName: branch_protection_allow_force_pushes
      status: failure

We should provide the user a better message in case the API is not enabled.

blkt avatar May 27 '24 12:05 blkt