Skip to content

Function deployment fails if functions folder not in project root #255

@depdg

Description

@depdg

My functions folder is on level /apps/myapp/functions instead of just /functions.
Also firebase.json is on level /apps/myapp.

Deploying function with PROJECT_PATH set still failes.

- name: Deploy Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only functions
env:
GCP_SA_KEY: ${{ secrets.GOOGLE_CREDENTIALS_BASE64 }}
PROJECT_ID: ${{ vars.FIREBASE_PROJECT_ID }}
PROJECT_PATH: ${{ github.workspace }}/apps/myapp

GitHub Action log:
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run build
npm error code ENOENT
npm error syscall open
npm error path /github/workspace/functions/package.json
npm error errno -2
npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/github/workspace/functions/package.json'

The debug log shows it actually runs this, where workdir is set to "/github/workspace":
/usr/bin/docker run --name w9jdsfirebaseactionv14140_b2e680 --label 4a74bc --workdir /github/workspace --rm -e "GCP_SA_KEY" -e "PROJECT_ID" -e "PROJECT_PATH" -e "INPUT_ARGS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_A

Another repo where the functions folder is on root works just fine.
Is that a bug or does anyone spot the error I made in my CI?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions