Skip to content

Unnecessary strict condition on cache-key when cache is false? #212

@jayqi

Description

@jayqi

I'm running into this validation check:

setup-pixi/src/options.ts

Lines 141 to 143 in 307e5e5

if (inputs.cacheKey !== undefined && inputs.cache === false) {
throw new Error('Cannot specify cache key without caching')
}

with the following Action configuration

      - uses: prefix-dev/[email protected]
        with:
          # Only cache for pull requests
          cache: ${{ github.event_name == 'pull_request' }}
          cache-key: ${{ steps.env_name.outputs.env_name }}
          environments: ${{ steps.env_name.outputs.env_name }}

I basically want whether caching happens to be conditional on some aspect of my workflow run (in this case, the event type that triggered it). Setting cache to false while leaving cache-key alone would be a nice elegant way to do this.

I'm not even sure actually how to do what I want without entirely having to duplicate the action block and condition on that level. Setting cache-key to null seems like it still wouldn't satisfy the undefined check.

I understand that someone who intends to cache and only sets cache-key would be getting a silent failure of caching functionality, but could this be a warning instead of a hard error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions