Merge pull request #2155 from tannewt/ignore_existing_files

When uploading release assets, ignore those already uploaded.
This commit is contained in:
Scott Shawcroft 2019-09-14 13:43:29 -07:00 committed by GitHub
commit 78318ae441
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -25,6 +25,9 @@ for dirpath, dirnames, filenames in os.walk("../bin"):
with open(full_filename, "rb") as f: with open(full_filename, "rb") as f:
response = github.post(url, data=f, headers=headers) response = github.post(url, data=f, headers=headers)
if not response.ok: if not response.ok:
if response.status_code == 422 and response.json().get("errors", [{"code":""}])[0]["code"] == "already_exists":
print("File already uploaded. Skipping.")
continue
print("Upload of {} failed with {}.".format(filename, response.status_code)) print("Upload of {} failed with {}.".format(filename, response.status_code))
print(response.text) print(response.text)
sys.exit(response.status_code) sys.exit(response.status_code)