Fix for new octokit

This commit is contained in:
Sven-Hendrik Haase 2020-07-03 06:59:57 +02:00
parent d082cf3f16
commit 7cac809eef
No known key found for this signature in database
GPG Key ID: 39E4B877E62EB915
2 changed files with 4 additions and 18 deletions

11
dist/index.js vendored
View File

@ -2226,7 +2226,6 @@ function upload_to_release(release, file, asset_name, tag, overwrite, octokit) {
core.debug(`Skipping ${file}, since its not a file`);
return;
}
const file_size = stat.size;
const file_bytes = fs.readFileSync(file);
// Check for duplicates.
const assets = yield octokit.repos.listReleaseAssets(Object.assign(Object.assign({}, github.context.repo), { release_id: release.data.id }));
@ -2245,15 +2244,7 @@ function upload_to_release(release, file, asset_name, tag, overwrite, octokit) {
core.debug(`No pre-existing asset called ${asset_name} found in release ${tag}. All good.`);
}
core.debug(`Uploading ${file} to ${asset_name} in release ${tag}.`);
yield octokit.repos.uploadReleaseAsset({
url: release.data.upload_url,
name: asset_name,
file: file_bytes,
headers: {
'content-type': 'binary/octet-stream',
'content-length': file_size
}
});
yield octokit.repos.uploadReleaseAsset(Object.assign(Object.assign({}, github.context.repo), { release_id: release.data.id, data: file_bytes }));
});
}
function run() {

View File

@ -51,7 +51,6 @@ async function upload_to_release(
core.debug(`Skipping ${file}, since its not a file`)
return
}
const file_size = stat.size
const file_bytes = fs.readFileSync(file)
// Check for duplicates.
@ -81,13 +80,9 @@ async function upload_to_release(
core.debug(`Uploading ${file} to ${asset_name} in release ${tag}.`)
await octokit.repos.uploadReleaseAsset({
url: release.data.upload_url,
name: asset_name,
file: file_bytes,
headers: {
'content-type': 'binary/octet-stream',
'content-length': file_size
}
...github.context.repo,
release_id: release.data.id,
data: file_bytes
})
}