# Actions - using with PHP / Composer and Github scripts

**URL:** <https://forum.gitea.com/t/actions-using-with-php-composer-and-github-scripts/7395>\
**Category:** Actions\
**Created:** [June 7, 2023, 3:47pm UTC](https://forum.gitea.com/t/actions-using-with-php-composer-and-github-scripts/7395 "2023-06-07T15:47:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pcmmf](https://avatars.discourse-cdn.com/v4/letter/p/5fc32e/32.png) [@pcmmf](https://forum.gitea.com/u/pcmmf)\
**Post date:** [June 7, 2023, 3:47pm UTC](https://forum.gitea.com/t/actions-using-with-php-composer-and-github-scripts/7395/1 "2023-06-07T15:47:28Z")

</div>

Hi,  
I currently use Gitea and Drone for running CI tasks and building Docker images. I’m trying to switch to Gitea Actions, starting by running some basic tasks as a test.

My `ci.yaml` workflow script is as follows:

```yaml
name: CI
on: [push]

jobs:
  build-test:
    runs-on: ubuntu-latest
    matrix:
      php-versions: ['8.2']

    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Setup Composer
        uses: https://github.com/php-actions/composer@v6
        # with:
        # php_version: ${{ matrix.php-version }}

      - run: echo "Composer dependencies have been installed"

      - run: vendor/bin/phpunit

```

The Action fails at the _Setup Composer_ stage. No errors are shown in Gitea, but checking the logs of the runner, I see the following:

```auto
runner_1 | [CI/build-test] [DEBUG] Working directory '/workspace/pcmmf/test-project'
runner_1 | [CI/build-test] ❌ Failure - Main set -e
runner_1 | bash <(curl -s https://raw.githubusercontent.com/php-actions/php-build/cee5b9fa9fbc4c888e7a62bbb7b8eade18e3c56b/php-build.bash) composer
runner_1 | /var/run/act/actions/https---github.com-php-actions-composer@v6/composer-action.bash
runner_1 | [CI/build-test] exitcode '127': command not found, please refer to https://github.com/nektos/act/issues/107 for more information

```

I’m running `gitea/gitea:1.19.3` and `gitea/act_runner:nightly` (having recently changed from 0.1.8), both in Docker.

Has anyone got a working example of setting up a PHP environment in Gitea Actions?

---

<div class="post-metadata">

**Author:** ![sillygudong](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/sillygudong/32/3515_2.png) [@sillygudong](https://forum.gitea.com/u/sillygudong)\
**Post date:** [June 14, 2023, 3:31am UTC](https://forum.gitea.com/t/actions-using-with-php-composer-and-github-scripts/7395/2 "2023-06-14T03:31:58Z")

</div>

What is the image of `ubuntu-latest` in the `.runner` file?

---

<div class="post-metadata">

**Author:** ![sillygudong](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/sillygudong/32/3515_2.png) [@sillygudong](https://forum.gitea.com/u/sillygudong)\
**Post date:** [June 14, 2023, 7:42am UTC](https://forum.gitea.com/t/actions-using-with-php-composer-and-github-scripts/7395/3 "2023-06-14T07:42:51Z")

</div>

I reproduced the problem.  
The script running on [this line](https://github.com/php-actions/composer/blob/9357db0fb3020086db5a9922354c8dc643927bcd/action.yml#LL105C9-L105C111) of this action tries to execute `docker login` command. But we don’t have docker installed in our default image (I guess you are using default labels).  
So you can specify the following image in workflow, and try again

```yaml
jobs:
  build-test:
    runs-on: ubuntu-latest
    container:
      image: catthehacker/ubuntu:act-latest

```

---

<div class="post-metadata">

**Author:** ![pcmmf](https://avatars.discourse-cdn.com/v4/letter/p/5fc32e/32.png) [@pcmmf](https://forum.gitea.com/u/pcmmf)\
**Post date:** [June 14, 2023, 8:15am UTC](https://forum.gitea.com/t/actions-using-with-php-composer-and-github-scripts/7395/4 "2023-06-14T08:15:55Z")

</div>

Thank you, I’ll test it this morning and will report back.

---

<div class="post-metadata">

**Author:** ![sillygudong](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/sillygudong/32/3515_2.png) [@sillygudong](https://forum.gitea.com/u/sillygudong)\
**Post date:** [June 15, 2023, 3:10am UTC](https://forum.gitea.com/t/actions-using-with-php-composer-and-github-scripts/7395/5 "2023-06-15T03:10:04Z")

</div>

@pcmmf hi, I also tried to use this action and found that it is not compatible with the container mode of Gitea Actions. For specific reasons, please refer to this [comment](https://gitea.com/gitea/act_runner/issues/189#issuecomment-740398).  
I forked the action repository and made some simple adaptations, see: [GitHub - sillyguodong/composer at gitea](https://github.com/sillyguodong/composer/tree/gitea)

And here is my workflow:

```yaml
name: CI
on: [push, issue_comment]

jobs:
  build-test:
    runs-on: ubuntu-latest
    container:
      image: catthehacker/ubuntu:act-latest
    env:
      RUNNER_TOOL_CACHE: /toolcache
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Docker Version
        run: docker version
      - name: Setup Composer
        uses: https://github.com/sillyguodong/composer@gitea
        with:
          php_version: "7.2"
          working_dir: ${{ github.workspace }}

```

---

<div class="post-metadata">

**Author:** ![pcmmf](https://avatars.discourse-cdn.com/v4/letter/p/5fc32e/32.png) [@pcmmf](https://forum.gitea.com/u/pcmmf)\
**Post date:** [June 16, 2023, 10:11am UTC](https://forum.gitea.com/t/actions-using-with-php-composer-and-github-scripts/7395/6 "2023-06-16T10:11:14Z")

</div>

Thank you, I’ll give that a try.
