Actually implement custom name

This commit is contained in:
Kodi Craft 2024-06-15 11:28:05 +02:00
parent 4cd3649cc1
commit 3ec7e74bf8
Signed by: kodi
GPG Key ID: 69D9EED60B242822

View File

@ -4,6 +4,7 @@ import github from '@actions/github'
import os from 'os'
import fs from 'fs'
import mime from 'mime'
import path from 'path'
try {
const file = core.getInput('file')
@ -16,10 +17,12 @@ try {
}
const machine_name = core.getInput('custom-machine-name') || os.hostname()
const custom_name = core.getInput('custom-name') || path.basename(file)
const mime_type = core.getInput('content-type') || mime.getType(file) || 'data/raw'
const use_salt = core.getInput('use-salt') === 'true'
console.log("Uploading file: ", file)
console.log("Name: ", custom_name)
console.log("Machine name: ", machine_name)
console.log("Content type: ", mime_type)
console.log("Use salt: ", use_salt)
@ -33,6 +36,7 @@ try {
headers: {
'Content-Type': mime_type,
'x-machine-name': machine_name,
'x-custom-name': custom_name,
'x-salt-name': use_salt ? 'true' : 'false',
'authorization': `Bearer ${token}`
}