-
Notifications
You must be signed in to change notification settings - Fork 9
feat: Add GitHub actions packager option #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Add GitHub actions packager option #65
Conversation
|
@appfr3d is attempting to deploy a commit to the Callstack Team on Vercel. A member of the Team first needs to authorize it. |
V3RON
left a comment
There was a problem hiding this 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
| elif [ -f "deno.lock" ]; then | ||
| echo "manager=deno" >> $GITHUB_OUTPUT | ||
| echo "runner=dx" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
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
Description
This PR automatically detects the packager and package runner to use when running
react-native-harnessin GitHub Actions, based on the lock file available in the repo.Related Issue
N/A
Context
I really like the
react-native-harnesslibrary, and just started using it on a clients project. That project usesnpmand notpnpmwhich 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:allandpnpm 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