composer icon indicating copy to clipboard operation
composer copied to clipboard

Error on install dependencies

Open 7system7 opened this issue 1 year ago • 1 comments

I would like to use this action, this is the step

      - name: Install dependencies
        uses: php-actions/composer@master
        with:
          command: install
          dev: no
          args: --profile --ignore-platform-req

I always got this error:

Building PHP latest with extensions:  ...
/usr/local/bin/docker-php-entrypoint: exec: line 9: composer: Permission denied

7system7 avatar Apr 24 '24 14:04 7system7

Same here, with @ v6 and @ master branch. :-(

image

Environment:

  • Forgejo 7.0.2-linux-amd64
  • Image: ghcr.io/catthehacker/ubuntu:act-latest (sha256:abfa2e1971b23fee51935eaf784863041846235c93318ff0f9cdff721fef5bc7)

bencurio avatar May 08 '24 08:05 bencurio

Similar with v6 in Gitea

🚀  Start image=gitea/runner-images:ubuntu-latest
  🐳  docker pull image=gitea/runner-images:ubuntu-latest platform= username= forcePull=true
  🐳  docker pull gitea/runner-images:ubuntu-latest
pulling image 'docker.io/gitea/runner-images:ubuntu-latest' ()
Pulling from gitea/runner-images :: ubuntu-latest
Digest: sha256:3610750b0bfe9f6fa5f5e910cf3fc20208623fd1992413f1bfc63b2d93ec775d ::

image

clifmo avatar Nov 11 '24 00:11 clifmo

Can anyone help me reproduce this issue? I use this action every day in my projects, and have no issues with permissions... but I run it within a normal Github Actions workflow - and I think you're using it elsewhere? Can you help me understand, so I can reproduce it myself?

g105b avatar Nov 18 '24 09:11 g105b

I trying to use in Gitea and getting the same error. Steps:

  • Setup Gitea self-hosted with an action runner (Gitea docs) (To get the REGISTRATION_TOKEN, you need to start Gitea service and go to: Admin Settings -> Actions -> Runners -> Create new Runner (after that you can update the docker-compose.yml to add the token and restart/recreate runner service))
services:
  gitea:
    image: docker.io/gitea/gitea:1.22.6
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=100
    restart: unless-stopped
    volumes:
      - ./gitea/data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
  runner:
    image: docker.io/gitea/act_runner:nightly
    container_name: gitea_runner
    environment:
      GITEA_INSTANCE_URL: "${INSTANCE_URL}"
      GITEA_RUNNER_REGISTRATION_TOKEN: "${REGISTRATION_TOKEN}"
      GITEA_RUNNER_NAME: "${RUNNER_NAME}"
      GITEA_RUNNER_LABELS: "${RUNNER_LABELS}"
    depends_on:
      - gitea
    restart: unless-stopped
    volumes:
      - ./gitea/runner:/data
      - /var/run/docker.sock:/var/run/docker.sock
  • create any repository with PHP code (in my case is an application using Laravel)
  • add file .gitea/workflows/test.yml with Gitea Actions Demo content and add php-actions/composer
name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on: [push]

jobs:
  Explore-Gitea-Actions:
    runs-on: ubuntu-latest
    steps:
      - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
      - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
      - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
      - name: Check out repository code
        uses: actions/checkout@v4
      - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
      - run: echo "🖥️ The workflow is now ready to test your code on the runner."
      - name: Install composer production dependencies
        uses: php-actions/composer@v6
        with:
          command: install
          php_version: "8.3"
          args: "--no-dev --ignore-platform-reqs --classmap-authoritative"
      - name: List files in the repository
        run: |
          ls ${{ gitea.workspace }}
      - run: echo "🍏 This job's status is ${{ job.status }}."
  • push this file to your Gitea repository and in the Actions tab you can follow the generated output

Image

helissonms avatar Jan 25 '25 19:01 helissonms

Hi! Try using this action: https://github.com/shivammathur/setup-php, I am currently using it, and it works. +1: These are the runner images I am currently using: https://github.com/catthehacker/docker_images.

bencurio avatar Jan 25 '25 19:01 bencurio

Can anyone help me reproduce this issue? I use this action every day in my projects, and have no issues with permissions... but I run it within a normal Github Actions workflow - and I think you're using it elsewhere? Can you help me understand, so I can reproduce it myself?

Gitea provides the ability to run GitHub Actions workflows within Gitea using the nektos/act project. It's possible that the official GitHub runner images include something that prevents this issue, which only occurs with Gitea Runners. By the way, nektos/act also allows running workflows locally (which is actually the project's original purpose). Using it, you could test whether the issue occurs in that environment as well. My guess is that an execution bit might simply be missing somewhere.

I'll test it tomorrow and let you know if I managed to run it successfully.

bencurio avatar Jan 25 '25 20:01 bencurio

Hi! Try using this action: https://github.com/shivammathur/setup-php, I am currently using it, and it works. +1: These are the runner images I am currently using: https://github.com/catthehacker/docker_images.

@bencurio that's worked perfectly, thanks!

helissonms avatar Jan 25 '25 20:01 helissonms