-
Notifications
You must be signed in to change notification settings - Fork 140
Description
Hello,
Over the past couple of months, I've noticed a recurring issue where Allstar returns 404 error messages when attempting to enforce branch protection, as shown in the logs below, causing the application to crash. The issue is still there with Allstar latest version (4.2)
allstar {"severity":"INFO","org":"Org","repo":"test0","area":"bot","enabled":true,"time":"2024-08-20T08:29:17Z","message":"Check repo enabled"}
allstar {"severity":"INFO","org":"Org","repo":"test0","area":"Binary Artifacts","enabled":false,"time":"2024-08-20T08:29:17Z","message":"Check repo enabled"}
allstar {"severity":"INFO","org":"Org","repo":"test0","area":"Binary Artifacts","result":true,"enabled":false,"notify":"","details":{"Artifacts":null},"time":"2024-08-20T08:29:17Z","message":"Policy run result."}
allstar {"severity":"INFO","org":"Org","repo":"test0","area":"Branch Protection","enabled":true,"time":"2024-08-20T08:29:17Z","message":"Check repo enabled"}
allstar {"severity":"INFO","org":"Org","repo":"test0","area":"Branch Protection","result":false,"enabled":true,"notify":"No protection found for branch master\n","details":{"master":{"PRReviews":false,"NumReviews":0,"DismissStale":false,"Bl
allstar {"severity":"ERROR","error":"PUT [https://api.github.com/repos/Org/test0/branches/master/protection](https://api.github.com/repos/Org/test0/branches/master/protection): 404 Branch protection has been disabled on this repository. []","time":"2024-08-20T08:29:18Z","message":"Unexpected error running policies."}
allstar {"severity":"INFO","area":"bot","count":7,"results":{"CODEOWNERS":{"totalFailed":1},"OpenSSF Scorecard":{"totalFailed":1},"Repository Administrators":{"totalFailed":1}},"time":"2024-08-20T08:29:18Z","message":"EnforceAll complete."}
After investigating, I found that this issue occurs when branch protection rules are disabled on a repository. I also noticed in the GitHub API documentation that while there is an API to update branch protection, there doesn’t seem to be one to set it initially. Could this be a new limitation from GitHub?
Currently, I’ve implemented a custom alerting system to manually re-enable branch protection rules when Allstar fails, but this is not an ideal solution. Is there a better workaround that you would recommend?
For reference, here are the current permissions for my Allstar GitHub App.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status