422 Target Validation Failed Error When Creating A Ruleset with targeted branches #119797
Replies: 1 comment
-
Hey @lado936 , I noticed you resolved this, was there something you needed to do to get it working? I'm finding a similar issue trying to create rulesets with the github terraform provider. It allows me to set an include pattern of "master" via the UI, but when I try via the API I get
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Select Topic Area
Bug
Body
Hello, i am using go sdk to create Repository with Rulesets, while Ruleset creation is working okay, if i set target branches like "main" "test", i get below error
![Screenshot 2024-04-16 at 17 14 32](https://private-user-images.githubusercontent.com/13964808/322856723-c6d66016-e23f-4b1d-b5a5-46e46c01ed4b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAwMjQzMTcsIm5iZiI6MTcyMDAyNDAxNywicGF0aCI6Ii8xMzk2NDgwOC8zMjI4NTY3MjMtYzZkNjYwMTYtZTIzZi00YjFkLWI1YTUtNDZlNDZjMDFlZDRiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzAzVDE2MjY1N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkyOGQwNWI4ZTY1MGQ1NDYxNjZiMGE2Njc3ZjE1NGJjYzA1YWIxNDk4YzQ5ZjgxMzIyZjI3MjUxNGM3ODZmNjImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.pnfH32X9T8fdHnCNBOagUpdTA6RhVZkCd4b-v9sbF4I)
DEBUG events PUT https://api.github.com/repos/test/test/rulesets/6545754: 422 Validation Failed [{Resource: Field: Code: Message:Invalid target patterns: 'test', 'main'}]
after many trials and errors, i tried to set branches not like main, but as "refs/heads/main", this one worked, but issue is that now in repo settings i see targeted branches are set like "refs/heads/refs/heads/main".
So either API should allow setting branch patterns without refs/heads/ prefix, or it should not be appended after i am setting it on my side
Beta Was this translation helpful? Give feedback.
All reactions