🔧 Send patch request

This commit is contained in:
Simon Schneegans
2020-08-15 12:48:07 +02:00
parent c086d4bce4
commit cf5a7526b6

View File

@@ -24,7 +24,28 @@ try {
let data = {files: {}};
data.files[badgeName] = {content: JSON.stringify(description)};
console.log(JSON.stringify(data));
const options = {
host: 'api.github.com',
path: '/gists/' + gistId,
auth: 'token ' + auth,
method: 'PATCH'
};
const callback = (response) => {
let str = '';
response.on('data', (chunk) => {
str += chunk;
});
response.on('end', () => {
console.log(str);
});
};
const req = http.request(options, callback);
req.write(JSON.stringify(data));
req.end();
} catch (error) {
core.setFailed(error.message);