add-and-commit icon indicating copy to clipboard operation
add-and-commit copied to clipboard

Error: spawn git ENOENT

Open vladRGaembla opened this issue 4 years ago • 6 comments

Describe the bug When we try to add files into git (translations) we always got this error: Error: Error: Error: spawn git ENOENT

Workflow used

      - name: Add lokalise translations
        uses: EndBug/add-and-commit@v9
        with:
          message: 'Push translations [translations skip]'
          default_author: github_actions
          add: 'lang'

Expected behavior Should add files and push them into the branch.

Logs image

vladRGaembla avatar Nov 21 '22 07:11 vladRGaembla

Hi, can you post the workflow used? I'm interested in the previous steps and the image that's being used by the runner

EndBug avatar Nov 21 '22 15:11 EndBug

@EndBug Here is full workflow


  push-translations:
    name: Pull and push translations
    runs-on: [hetzner,light]
    container:
      image: "node:18-bullseye-slim"
    needs: [install]
    steps:
      - uses: actions/checkout@v2
      - name: Restore node_modules cache
        uses: actions/cache@v2
        with:
          path: node_modules
      - name: Extract translations
        run: |
          yarn install
          yarn translation:extract
      - name: Push translations
        run: |
          yarn translation:push
      - name: Pull translations
        uses: nick-fields/retry@v2
        with:
          command: yarn translation:pull
      - name: Compile translations
        run: |
          yarn translation:compile
      - name: Add lokalise translations
        uses: EndBug/add-and-commit@v9
        with:
          message: 'Push translations [translations skip]'
          default_author: github_actions
          add: 'lang'

vladRGaembla avatar Nov 23 '22 07:11 vladRGaembla

Can you please make sure that the "node:18-bullseye-slim" image has git installed?

EndBug avatar Nov 23 '22 15:11 EndBug

@EndBug Hey. Thanks for the suggestion. Now i got the new error.

Workflow

   push-translations:
    name: Pull and push translations
    runs-on: [hetzner,light]
    container:
      image: "node:18-bullseye-slim"
    needs: [install]
    steps:
      - uses: actions/checkout@v3
        with:
          ref: ${{ github.event.pull_request.head.ref }}
          token: ${{ secrets.REPO_TOKEN }}
      - name: Ensure git is present # New changes
        run: |
          apt-get update -y
          apt-get install git -y
      - name: Restore node_modules cache
        uses: actions/cache@v3
        with:
          path: node_modules
          key: node_modules_cache-${{ hashFiles('yarn.lock') }}
          restore-keys: node_modules_cache-${{ hashFiles('yarn.lock') }}
      - name: Extract translations
        run: |
          yarn install
          yarn translation:extract
      - name: Push translations
        run: |
          yarn translation:push
      - name: Pull translations
        uses: nick-fields/retry@v2
        with:
          command: yarn translation:pull
      - name: Compile translations
        run: |
          yarn translation:compile
      - name: Add lokalise translations
        uses: EndBug/add-and-commit@v9
        with:
          message: 'Push translations [translations skip]'
          default_author: github_actions
          add: 'lang'

And logs image

vladRGaembla avatar Dec 04 '22 19:12 vladRGaembla

I would try installing git before checking out the repository, so that the repository can be correctly set up

EndBug avatar Dec 05 '22 14:12 EndBug

@EndBug THank you! This is helped me

vladRGaembla avatar Dec 08 '22 09:12 vladRGaembla