setup-localstack icon indicating copy to clipboard operation
setup-localstack copied to clipboard

LocalStack does not support Act (nektos/act) due to GH_ACTION_ROOT logic.

Open furan917 opened this issue 1 year ago • 1 comments

If you try to use this action via Act, e.g act --container-architecture linux/amd64 -W .github/workflows/localstack.yml You will get the error: Expected format {org}/{repo}[/path]@ref. Actual '/startup' Input string was not in a correct format

Here's its output

# docker cp src=/Users/myname/.cache/act/[email protected]/ dst=/var/run/act/actions/[email protected]/

# echo "GH_ACTION_ROOT=$(
  ls -d $(
    ls -d ./../../_actions/* |
    grep -i localstack |
    tail -n1
  )/setup-localstack/* | 
  grep -v completed | 
  tail -n1
)" >> $GITHUB_ENV

# docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1-composite-0.sh] user= workdir=
| ls: cannot access './../../_actions/*': No such file or directory
| ls: cannot access '/setup-localstack/*': No such file or directory

# echo "GH_ACTION_ROOT=$(
  ls -d $(
    ls -d ./../../_actions/* |
    grep -i localstack |
    tail -n1
  )/setup-localstack/* | 
  grep -v completed | 
  tail -n1
)" >> $GITHUB_ENV

#  ::set-env:: GH_ACTION_ROOT=

As you can see this can't parse the path, and ends up blank.

furan917 avatar Aug 02 '24 12:08 furan917

I've run into this as well

siennathesane avatar Aug 15 '24 19:08 siennathesane

Hi @furan917 and @siennathesane! setup-localstack is using a hacky way to keep itself modular, DRY and consistent with its "sub" actions' version with the main action's. Since GHA doesn't provide an option to use sub actions with dynamically defined version and a hardcoded main branch might contains breaking changes we had to take leverage of the locally cached actions on the shared GH runners. The cache by default lives under the ./../../_actions folder, so unless you explicitly create this cache on your runner the action will most probably fail on act.

From what I understand from go, it seems act generates a different path pattern ie: dst=/var/run/act/actions/.cache/<XYZ>/ And it seems act doesn't provide options to customise this but hardcodes the /actions/ folder. (see here the relevant code). The issue could be worked around if the cache would be constructed in a similar manner as it's constructed on shared runners, with the /_actions/ folder name.

lakkeger avatar Aug 20 '24 13:08 lakkeger