sigmavirus24 / github3.py

Hi, I'm a library for interacting with GItHub's REST API in a convenient and ergonomic way. I work on Python 3.6+.
https://github3.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.21k stars 402 forks source link

content.update() not working for a branch #1117

Open mscherfling opened 1 year ago

mscherfling commented 1 year ago

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?

sigmavirus24 commented 1 year ago

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

staticdev commented 1 year ago

@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.