From 6242095e7207facf115ac4439760356bc52760ac Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Thu, 7 Mar 2024 20:15:45 +0100 Subject: [PATCH] handle errors in dep, correctly catch missing url in version check (#65) * handle errors in dep, correctly catch missing url in version check replace console.error with throw to handle dep error failures in main try/catch to mark job as failed in one place * add test action, prevent failure on empty options * fix conflict resolution --- .github/workflows/test.yml | 17 +++++++++++++++++ index.js | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..497d54a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,17 @@ +name: 'build-test' +on: # rebuild any PRs and main branch changes + pull_request: + push: + branches: + - master + - 'releases/*' + +jobs: + test: # make sure the action works on a clean machine without building + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./ + with: + dep: list + deployer-version: "7.3.0" diff --git a/index.js b/index.js index 389b2c6..ae4ad58 100644 --- a/index.js +++ b/index.js @@ -94,8 +94,8 @@ async function dep() { break } } - if (url === null) { - console.error(`The version "${version}"" does not exist in the "https://deployer.org/manifest.json" file."`) + if (typeof url === 'undefined') { + core.setFailed(`The version "${version}"" does not exist in the "https://deployer.org/manifest.json" file."`) } else { console.log(`Downloading "${url}".`) await $`curl -LO ${url}`