andresz1 / size-limit-action

Compare the real cost to run your JS app or lib to keep good performance in every pull request
ISC License
450 stars 84 forks source link

bin/sh: 1: undefined: not found when running on self-hosted runner #119

Open PoorviSimpplr opened 1 month ago

PoorviSimpplr commented 1 month ago

size-limit-action is giving error while running on self-hosted github runner .There is no issue when it runs on github-runner .As we have some dependency to run our jobs only on self-hosted runner please help out to resolve this . Attaching the workflow file and error screenshot .

ERROR

 /home/runner/_work/_tool/node/20.11.0/x64/bin/npx size-limit --json
/bin/sh: 1: undefined: not found
[
  {
    "name": "dist/index.js",
    "passed": true,
    "size": 687382,
    "sizeLimit": 800000,
    "running": 7.[13](https://github.com/actions/runs/11267595117/job/31332972575#step:14:14)5833333333334,
    "loading": 13.4254296875
  }
]

Workflow file

name: CI

on:
  pull_request:
    branches:
      - main
  push:
    branches:
      - main

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  NPM_TOKEN: ${{ secrets.TOKEN }}

jobs:
  CI:
    runs-on: kubernetes
    defaults:
      run:
        shell: bash
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      # we could use `corepack enable` instead but `setup-node` requires pnpm already exists
      - uses: pnpm/action-setup@v2

      - uses: actions/setup-node@v4
        with:
          node-version-file: .node-version
          cache: pnpm

      - run: pnpm install

      - if: github.event_name == 'push'
        name: Check current commit
        run: pnpm exec commitlint --from HEAD~1 --to HEAD --verbose

      - if: github.event_name == 'pull_request'
        name: Check new commits
        run: pnpm exec commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose

      - if: ${{ !cancelled() }}
        name: Lint
        run: pnpm lint
        continue-on-error: true # TODO

      - if: ${{ !cancelled() }}
        name: Type check
        run: pnpm type-check

      - if: ${{ !cancelled() }}
        name: Test
        run: pnpm test

      - if: ${{ !cancelled() }}
        name: Build
        run: pnpm build

      - if: ${{ !cancelled() }}
        uses: sonarsource/sonarqube-scan-action@master
        env:
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
          SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

      - if: ${{ !cancelled() && github.event_name == 'pull_request' }}
        uses: andresz1/size-limit-action@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          skip_step: build

      - if: ${{ github.event_name == 'push' }}
        name: Upload translations
        run: pnpm upload-translations

      - if: ${{ github.event_name == 'push' }}
        name: Release
        run: pnpm semantic-release --branches main
        env:
          GITHUB_TOKEN: ${{ env.NPM_TOKEN }}
          LEFTHOOK: 0 # disable git hook on push
          NPM_TOKEN: ${{ env.NPM_TOKEN }}
webronak commented 1 month ago

Facing the same issue, while running on Kubernetes.