Which package manager?

GitHub code size in bytes GitHub GitHub package.json version

Twitter Follow

A GitHub action that will quickly return which node.js package manager the current repo is using.

I threw this together to stick between actions/checkout and actions/setup-node in a workflow I am using to tell actions/setup-node which cache method to use.

No inputs are required. This will return the name of the package manager (npm, pnpm or yarn) to the output value package_manager.

Example usage

name: Run Linter
    name: Run Linter
    runs-on: ubuntu-latest
      - name: Checkout code
        uses: actions/[email protected]
          ref: ${{ github.head_ref }}

        # This is the only setup needed #
      - name: Identify package manager
        id: pkgman
        uses: joekarow/[email protected]

      - name: Install package managers globally
        run: npm -g install pnpm yarn

      - name: Setup node env
        if: ${{ success() }}
        uses: actions/[email protected]
          node-version-file: ".nvmrc"
          cache: ${{ steps.pkgman.outputs.package_manager }} # This references the output value

      - name: Install dependencies
        if: ${{ success() }}
        uses: jaid/[email protected]
          packageManager: ${{ steps.pkgman.outputs.package_manager }}

      - name: Run lint step
        if: ${{ success() }}
        run: ${{ steps.pkgman.outputs.package_manager }} run lint


Setting up

git clone https://github.com/JoeKarow/act-which-package-mgr.git
cd act-which-package-mgr
pnpm install

After editing in the src/ directory, run pnpm run build to compile.

node dist/index.js will execute the file.


Reach out to the maintainer at one of the following places:


First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are greatly appreciated.

Please read our contribution guidelines, and thank you for being involved!

Authors & contributors

The original setup of this repository is by Joe Karow.

For a full list of all authors and contributors, see the contributors page.


act-which-package-mgr follows good practices of security, but 100% security cannot be assured. act-which-package-mgr is provided “as is” without any warranty. Use at your own risk.

For more information and to report security issues, please refer to our security documentation.


This project is licensed under the GNU General Public License v3.

See LICENSE for more information.


View Github