Compare commits

..

No commits in common. "main" and "v1.0-rc.2" have entirely different histories.

2 changed files with 1 additions and 40 deletions

View File

@ -1,31 +0,0 @@
on:
push:
branches:
- main
workflow_dispatch:
jobs:
test-action:
runs-on: nix
name: Upload and download test
steps:
- name: Create sample file
run: echo "Hello, world!" > test.txt
- name: Upload to lgoad
id: upload
uses: https://git.colon-three.com/kodi/lgoad-upload-action@main
with:
file: test.txt
token: ${{ secrets.LGOAD_TOKEN }}
custom-machine-name: 'github-action-test-machine'
content-type: 'text/plain'
custom-name: 'test.txt'
use-salt: 'true'
- name: Print the URL
run: echo "The URL is ${{ steps.upload.outputs.url }}"
- name: Check that the file is correctly uploaded
run: |
curl -s -o test-uploaded.txt ${{ steps.upload.outputs.url }}
nix shell "nixpkgs#diffutils" -c diff test.txt test-uploaded.txt
rm test.txt

View File

@ -10,12 +10,10 @@ try {
const file = core.getInput('file') const file = core.getInput('file')
if (!file) { if (!file) {
core.setFailed('"file" is required') core.setFailed('"file" is required')
process.exit(1)
} }
const token = core.getInput('token') const token = core.getInput('token')
if (!token) { if (!token) {
core.setFailed('"token" is required') core.setFailed('"token" is required')
process.exit(1)
} }
const machine_name = core.getInput('custom-machine-name') || os.hostname() const machine_name = core.getInput('custom-machine-name') || os.hostname()
@ -42,13 +40,7 @@ try {
'x-salt-name': use_salt ? 'true' : 'false', 'x-salt-name': use_salt ? 'true' : 'false',
'authorization': `Bearer ${token}` 'authorization': `Bearer ${token}`
} }
}).then(response => { }).then(response => { return response.text() })
if (!response.ok) {
console.log("Got response: ", response)
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.text()
})
.then(uri => { .then(uri => {
console.log("Uploaded to: ", uri) console.log("Uploaded to: ", uri)
core.setOutput('uri', uri) core.setOutput('uri', uri)