From cb27a0368572524a41df0b568b357086d6f1f210 Mon Sep 17 00:00:00 2001 From: Pavel Zwerschke Date: Mon, 4 Sep 2023 20:02:57 +0200 Subject: [PATCH] Fix behavior for create-args without env name (#141) --- .github/labeler.yml | 8 -------- .github/workflows/label.yml | 6 ------ .github/workflows/test.yml | 15 +++++++++++++++ dist/index.js | 3 +++ dist/post.js | 3 +++ src/options.ts | 3 +++ 6 files changed, 24 insertions(+), 14 deletions(-) delete mode 100644 .github/labeler.yml diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index 829aa7a..0000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,8 +0,0 @@ -ci: - - .github/workflows/* - -documentation: - - '*.md' - -dependencies: - - pnpm-lock.yaml diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index f80e09f..edcb4b4 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -8,13 +8,7 @@ jobs: pr-label: runs-on: ubuntu-latest steps: - - uses: actions/labeler@v4 - if: github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'edited' || github.event.action == 'synchronize' - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" - id: labeler - uses: mheap/github-action-required-labels@v5 - if: steps.labeler.outputs.new-labels == '' with: labels: bug,enhancement,ci,documentation,dependencies,ignore-for-release mode: minimum diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5e2a37f..c33f582 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -271,3 +271,18 @@ jobs: id: setup-micromamba - run: | test "${{ steps.setup-micromamba.outputs.environment-path }}" = "" + + # not properly testable + # https://github.com/actions/runner/issues/2347 + # https://github.com/orgs/community/discussions/15452 + # create-args-no-env-name: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # - uses: ./ + # with: + # create-args: >- + # python + # pytest + # - run: exit 1 + # if: success() diff --git a/dist/index.js b/dist/index.js index 60275f7..c0522d2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -65190,6 +65190,9 @@ var validateInputs = (inputs) => { if (inputs.initShell?.includes("none") && inputs.initShell.length !== 1) { throw new Error("You cannot specify 'none' with other shells."); } + if (!inputs.environmentName && !inputs.environmentFile && inputs.createArgs?.length) { + throw new Error("You need to specify an environment name."); + } }; var assertOptions = (options2) => { const assert = (condition, message) => { diff --git a/dist/post.js b/dist/post.js index a5ad657..b0b2f05 100644 --- a/dist/post.js +++ b/dist/post.js @@ -61584,6 +61584,9 @@ var validateInputs = (inputs) => { if (inputs.initShell?.includes("none") && inputs.initShell.length !== 1) { throw new Error("You cannot specify 'none' with other shells."); } + if (!inputs.environmentName && !inputs.environmentFile && inputs.createArgs?.length) { + throw new Error("You need to specify an environment name."); + } }; var assertOptions = (options2) => { const assert = (condition, message) => { diff --git a/src/options.ts b/src/options.ts index ca44766..f55b7be 100644 --- a/src/options.ts +++ b/src/options.ts @@ -171,6 +171,9 @@ const validateInputs = (inputs: Inputs): void => { if (inputs.initShell?.includes('none') && inputs.initShell.length !== 1) { throw new Error("You cannot specify 'none' with other shells.") } + if (!inputs.environmentName && !inputs.environmentFile && inputs.createArgs?.length) { + throw new Error('You need to specify an environment name.') + } } const assertOptions = (options: Options) => {