github3.py icon indicating copy to clipboard operation
github3.py copied to clipboard

content.update() not working for a branch

Open mscherfling opened this issue 3 years ago • 2 comments

I get a 409 attempting to update a branch file. The logs show

2022-11-10 15:10:39,888 DEBUG [models] PUT https://github.xxx.com/api/v3/repos/owner/repo/contents/create_file.txt?ref=test-branch9 with {'data': '{"message": "test-branch9 2", "content": "dGVzdC1icmFuY2g5IDI=", "sha": "3f108ed16ed0e4775c6a574d4d06701495e6084b"}'}
2022-11-10 15:10:40,024 DEBUG [connectionpool] https://github.xxx.com:443 "PUT /api/v3/repos/owner/repo/contents/create_file.txt?ref=test-branch9 HTTP/1.1" 409 198

I ran the same PUT successfully as a curl command, removing '?ref=test-branch9' and adding it into the data portion as "branch": "test-branch9"

We're currently on v3.1.23, but scheduled to upgrade to 3.3 shortly. Will the API interface change to correctly work in 3.3?

mscherfling avatar Nov 10 '22 20:11 mscherfling

It's fixed in main but I don't recall if it's been released

https://github.com/sigmavirus24/github3.py/blob/main/src/github3/repos/contents.py#L188

sigmavirus24 avatar Nov 10 '22 23:11 sigmavirus24

@sigmavirus24 I just checked last tag is from March 2022. This change should be in 3.2.0, but we some feature PRs, maybe time for a 3.3.0? There is deprecation of EOL Python 3.6 on it.

staticdev avatar Nov 17 '22 12:11 staticdev