|
| 1 | +name: 'Install review-cli' |
| 2 | +description: 'Set up Bun and install @uniswap/review-cli from GitHub Packages into an isolated $RUNNER_TEMP directory.' |
| 3 | + |
| 4 | +inputs: |
| 5 | + version: |
| 6 | + description: '@uniswap/review-cli version to install (e.g. 1.2.0). Pin via vars.REVIEW_CLI_VERSION at the call site.' |
| 7 | + required: true |
| 8 | + github-token: |
| 9 | + description: 'Token with packages:read scope. Typically secrets.GITHUB_TOKEN.' |
| 10 | + required: true |
| 11 | + bun-version: |
| 12 | + description: 'Bun runtime version. Must satisfy @uniswap/review-cli engines (>=1.3.13).' |
| 13 | + default: '1.3.13' |
| 14 | + |
| 15 | +outputs: |
| 16 | + bin-path: |
| 17 | + description: 'Absolute path to the directory containing the review-cli binary. Callers should invoke "${bin-path}/review-cli" rather than relying on $PATH.' |
| 18 | + value: ${{ steps.install.outputs.bin-path }} |
| 19 | + |
| 20 | +runs: |
| 21 | + using: composite |
| 22 | + steps: |
| 23 | + - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 |
| 24 | + with: |
| 25 | + bun-version: ${{ inputs.bun-version }} |
| 26 | + |
| 27 | + # @uniswap/review-cli is private on GitHub Packages, and Bun (like npm) |
| 28 | + # only supports per-SCOPE registry overrides. Installing from a scratch |
| 29 | + # dir with its own bunfig.toml routes @uniswap to GH Packages without |
| 30 | + # touching the repo's own registry config. Transitive deps (no |
| 31 | + # @uniswap/*) come from npmjs.org per bun's built-in default. |
| 32 | + # |
| 33 | + # Bin path is exposed via the `bin-path` step output rather than |
| 34 | + # written to GITHUB_PATH — the output forces callers to opt in |
| 35 | + # explicitly per-step (zizmor `github-env`). |
| 36 | + - name: Install @uniswap/review-cli (isolated registry context) |
| 37 | + id: install |
| 38 | + shell: bash |
| 39 | + env: |
| 40 | + GH_PACKAGES_TOKEN: ${{ inputs.github-token }} |
| 41 | + REVIEW_CLI_VERSION: ${{ inputs.version }} |
| 42 | + run: | |
| 43 | + set -euo pipefail |
| 44 | + install_dir="$RUNNER_TEMP/review-cli-install" |
| 45 | + mkdir -p "$install_dir" |
| 46 | + cat > "$install_dir/bunfig.toml" <<EOF |
| 47 | + [install.scopes] |
| 48 | + "@uniswap" = { url = "https://npm.pkg.github.com", token = "$GH_PACKAGES_TOKEN" } |
| 49 | + EOF |
| 50 | + cd "$install_dir" |
| 51 | + bun init -y > /dev/null |
| 52 | + bun add "@uniswap/review-cli@${REVIEW_CLI_VERSION}" |
| 53 | + echo "bin-path=$install_dir/node_modules/.bin" >> "$GITHUB_OUTPUT" |
0 commit comments