Skip to content

This action is broken from v0.3 - command arguments are ignored resulting in errors #16

@antoine-sac

Description

@antoine-sac

This github action does not work at all in v0.3 and v0.4 (at least on ubuntu-latest) because there is an error in the entrypoint. All commands taking arguments are impacted.

When you use args like . dataset export production backup.tar.gz, the command getting executed is only sanity dataset which of course doesn't do anything but complain that the usage is not correct.

The reason is this line in entrypoint.sh:

sh -c "cd $1 && sanity install && SANITY_AUTH_TOKEN=$SANITY_AUTH_TOKEN sanity ${@:2:99}"

The problem is that ${@:2:99} is not compatible with basic shells like /bin/sh. To confirm it, you can create a simpler entrypoint showing what it executes:

sh -c "echo SANITY_AUTH_TOKEN=$SANITY_AUTH_TOKEN sanity ${@:2:99}"

which gives, on my machine:

$ ./entrypoint.sh . dataset export production backup.tar.gz
SANITY_AUTH_TOKEN=REDACTED sanity dataset

In summary : everything after the first command is ignored which breaks all workflows.

A simple fix is to use the shift operator which is standard shell:

#!/bin/bash

set -e

sh -c "cd $1 && sanity install"
shift
sh -c "SANITY_AUTH_TOKEN=$SANITY_AUTH_TOKEN sanity $*"

Another fix is to simply not call sh -c but run the commands directly.

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