Tweaks and error handling
All checks were successful
/ Upload and download test (push) Successful in 24s
All checks were successful
/ Upload and download test (push) Successful in 24s
This commit is contained in:
parent
c084c40288
commit
be8432c7dd
2
.github/workflows/test.yaml
vendored
2
.github/workflows/test.yaml
vendored
@ -7,7 +7,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
test-action:
|
test-action:
|
||||||
runs-on: nix
|
runs-on: nix
|
||||||
name: Tests that the action works as expected
|
name: Upload and download test
|
||||||
steps:
|
steps:
|
||||||
- name: Create sample file
|
- name: Create sample file
|
||||||
run: echo "Hello, world!" > test.txt
|
run: echo "Hello, world!" > test.txt
|
||||||
|
8
index.js
8
index.js
@ -42,7 +42,13 @@ try {
|
|||||||
'x-salt-name': use_salt ? 'true' : 'false',
|
'x-salt-name': use_salt ? 'true' : 'false',
|
||||||
'authorization': `Bearer ${token}`
|
'authorization': `Bearer ${token}`
|
||||||
}
|
}
|
||||||
}).then(response => { return response.text() })
|
}).then(response => {
|
||||||
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user