Skip to content

[Feature request] Support for corepack #256

@webbertakken

Description

@webbertakken

Context

Corepack helps automatically selecting the tools that are specified by a project.

For example, it takes "packageManager": "[email protected]" from package.json, to automatically not use yarn 1.22 but the specified one (i.e. the same one that was used to generate the lockfile).

Problem

Right now it fails when you use the packageManager field with the following error:

error This project's package.json defines "packageManager": "[email protected]". However the current global version of Yarn is 1.22.22.
Full log

Link to workflow run (while it lasts)

Run w9jds/[email protected]
  with:
    args: deploy --only functions:testFunction
  env:
    GCP_SA_KEY: ***
/usr/bin/docker run --name w9jdsfirebaseactionv14190_797e39 --label f3ac5f --workdir /github/workspace --rm -e "GCP_SA_KEY" -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_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/versioning-backend/versioning-backend":"/github/workspace" w9jds/firebase-action:v14.19.0 deploy --only functions:testFunction
Storing the decoded GCP_SA_KEY in /opt/gcp_key.json
Exporting GOOGLE_APPLICATION_CREDENTIALS=/opt/gcp_key.json

=== Deploying to 'unity-ci-versions'...

i  deploying functions
Running command: yarn --cwd "$RESOURCE_DIR" lint
error This project's package.json defines "packageManager": "[email protected]". However the current global version of Yarn is 1.22.22.

Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19.
Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.

Error: functions predeploy error: Command terminated with non-zero exit code 1

Proposed solution

Enable corepack in the action, so that it may automatically detect it.

Considered alternatives

Right now I'm hacking around it like this (yup that works)

      - name: Deploy test to Firebase
        uses: w9jds/[email protected]
        with:
-          args: deploy --only functions:testFunction
+          args: help ; corepack enable ; corepack install ; firebase deploy --only functions:testFunction

But would be able to have native support from the action.

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