Skip to content

Conversation

@appfr3d
Copy link

@appfr3d appfr3d commented Feb 3, 2026

Description

This PR automatically detects the packager and package runner to use when running react-native-harness in GitHub Actions, based on the lock file available in the repo.

Related Issue

N/A

Context

I really like the react-native-harness library, and just started using it on a clients project. That project uses npm and not pnpm which is currently hardcoded into the GitHub Actions. Since your "Getting started" guides suggest that this library supports multiple different packagers, I created this PR to make the GitHub Actions also support different packagers.

Testing

Not sure how to test this change, but it passes pnpm test:all and pnpm typecheck:all.
Also tested on clients GitHub Actions by referencing the fork like this
uses: appfr3d/react-native-harness/actions/ios@github-actions-packager-option

@vercel
Copy link

vercel bot commented Feb 3, 2026

@appfr3d is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@V3RON V3RON left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be easier to just have a short shell script that checks the working directory, figures out which lockfile is present, and sets a variable based on that? Then we can use that variable in the next step to run Harness.

- name: Detect Package Manager
    id: detect-pm
    run: |
      if [ -f "pnpm-lock.yaml" ]; then
        echo "manager=pnpm" >> $GITHUB_OUTPUT
        echo "runner=pnpm exec" >> $GITHUB_OUTPUT
      elif [ -f "yarn.lock" ]; then
        echo "manager=yarn" >> $GITHUB_OUTPUT
        echo "runner=yarn" >> $GITHUB_OUTPUT
      elif [ -f "bun.lockb" ]; then
        echo "manager=bun" >> $GITHUB_OUTPUT
        echo "runner=bun x" >> $GITHUB_OUTPUT
      else
        echo "manager=npm" >> $GITHUB_OUTPUT
        echo "runner=npx" >> $GITHUB_OUTPUT
      fi

  - name: Run CLI Tool
    run: ${{ steps.detect-pm.outputs.runner }} react-native-harness

Comment on lines +117 to +119
elif [ -f "deno.lock" ]; then
echo "manager=deno" >> $GITHUB_OUTPUT
echo "runner=dx" >> $GITHUB_OUTPUT
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like dx is the new npx in deco-land, but it is quite new so I can change to deno run -A npm: if desired.
Ref: https://deno.com/blog/v2.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants