Php-actions/composer action works differently with act then on gh pipeline

Hello,
I am facing a strange behaviour, that the following is working when running with act, but eventually not on the github actions pipeline.
Additionally it seems the command arguments are ignored on gh, looking like a totally different command.

The error:

 Validate composer.json and composer.lock

Run php-actions/composer@v1
/usr/bin/docker run --name d3846f685cbeb24490894289a331ec3e79_bb0ca6 --label 3888d3 --workdir /github/workspace --rm -e CI -e INPUT_COMMAND -e INPUT_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/redacted/redacted":"/github/workspace" 3888d3:846f685cbeb24490894289a331ec3e79  "composer" "--no-progress"
               
  [Symfony\Component\Console\Exception\CommandNotFoundException]  
  Command "composer" is not defined.                              

The yaml:

jobs:
  build:
    name: Build
    runs-on: ubuntu-18.04
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 10

      - name: Validate composer.json and composer.lock
        uses: php-actions/composer@v1
        with:
          command: composer
          args: validate -n -d ./site
        

Also tried with a simple command: validate -n -d ./site just to make sure its not just appended to the docker run, but also did not work.

A bit lost here. Any ideas?

Thanks alot!

Hi @maxmarkus,

Glad to see you in Github Community Forum!

I can repro the same error on my side. There is already an issue raised for custom command of the action here: https://github.com/php-actions/composer/issues/4. You can comment there to ask for a fix.

As an alternative, i directly use doc image for the step and set custom command in ‘args’.

      uses: "docker://composer:latest"
      with:
        args: "composer install"

It can append the command to dock run. Please check my workflow here for your reference.

Thanks.

2 Likes

Hi @weide-zhou,

I have seen that issue and followed the approach this user suggested, but maybe I misinterpreted it. https://github.com/php-actions/composer/issues/4#issuecomment-622326597

Thanks for sharing your workflow!

Best, Markus.

Hi @maxmarkus,

Thanks for your reply!

The suggestion in the issue only works with act on local client, it will report error on Github action(web) directly.
Please add a comment or raise a new issue for the action.
BTW, does the workaround work for you?