Relative path to 'main' in local action

Hello,

I’m setting up a repository with a workflow that uses a local JavaScript action. The action’s runs.main uses a file relative to the action, which is how the tutorials have it, and how I would expect it to work intuitively. However, the action seems to be looking for the main from the root of the workspace instead. Is that expected?

My abbreviated directory structure:

.github
├── actions
│   └── auth0-deploy
│       ├── action.yml
│       ├── dist
│       │   └── index.js
│       ├── package-lock.json
│       ├── package.json
│       ├── src
│       │   ├── index.ts
│       └── tsconfig.json
└── workflows
    └── deploy-auth0-tenants.yml

.github/workflows/deploy-auth0-tenants.yml

name: Deploy Auth0 Tenants
on: push

jobs:
  deploy_to_auth0:
    name: Deploy to Auth0
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Decrypt Config
        uses: zemuldo/git-crypt-unlock@v2.0
        env:
          GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
          GPG_KEY_GRIP: ${{ secrets.GPG_KEY_GRIP }}
          GPG_KEY_PASS: ${{ secrets.GPG_KEY_PASS }}
      - name: Debug environment
        run: |
          pwd && ls -al
      - name: Auth0 deployment
        uses: ./.github/actions/auth0-deploy

.github/actions/auth0-deploy/action.yml

name: auth0-deploy
description: Deploys configuration to Auth0 tenants
author: CyberScout, LLC
inputs:
  prod-branch:
    description: Name of the branch to consider "production". Default is "master".
    required: false
runs:
  using: node12
  main: 'dist/index.js'

The error I get is:

Error: Cannot find module '/github/workspace/dist/index.js'

Hi @macdaddyaz,

Glad to see you in Github Community Forum!
I followed your repo structure and create own one, same setting but no error reported.
Your error should be caused by incorrect location specified somewhere for dist/index.js. Do you have other setting?
After the checkout action, before your own action, please use “cd .github…” and ‘ls -al’ to check your folder strucuture. If it looks fine, please check your .json and yaml if there are some location specified.

My repo for your reference: https://github.com/weide-zhou/hello-github-actions/tree/master/.github/actions/auth0-deploy
My workflow: https://github.com/weide-zhou/hello-github-actions/actions/runs/140467606/workflow

Thanks

Thank you for the help, @weide-zhou. It looks like it’s an issue with a tool I was using to test my actions locally. Once I pushed the code up to GitHub, the action was able to run just fine. I’ll open an issue with that project.