Search code examples
github-actionscicd

Can not run github action


I created action.yml like that

name: PHPUnit 5.6
description: Run your PHPUnit tests with php 5.6 in your Github Actions.
inputs:
  coverage_html:
    description: Generate code coverage report in HTML format
    required: false

  coverage_text:
    description: Generate code coverage report in text format (true to output to console, path to output to file)
    required: false

  coverage_xml:
    description: Generate code coverage report in PHPUnit XML format
    required: false

  args:
    description: Extra arguments to pass to the phpunit binary
    required: false
runs:
  using: "composite"
  steps:
    - run: entrypoint.sh
      shell: bash

entrypoint.sh

docker ps

But when action run, i got following error

Error: nguyenthemanh2601/phpunit/v1/action.yml (Line: 22, Col: 7): There's not enough info to determine what you meant. Add one of these properties: run, shell, uses, with, working-directory
Error: nguyenthemanh2601/phpunit/v1/action.yml (Line: 22, Col: 7): There's not enough info to determine what you meant. Add one of these properties: run, shell, uses, with, working-directory
Error: System.ArgumentException: Unexpected type '' encountered while reading 'steps item uses'. The type 'StringToken' was expected.

I'm trying to follow the example here But it's not working


Solution

  • After checking the public repository with the action implementation, I identified two issues:

    1. To call the script located in the action repository, during the composite action execution, you need to set the github.action_path in the $GITHUB_PATH (runner system path) for the action to be able to locate the entrypoint.sh file.
    runs:
      using: "composite"
      steps:
        - run: echo "${{ github.action_path }}" >> $GITHUB_PATH
          shell: bash
        - run: entrypoint.sh
          shell: bash
    
    1. You created a @v1 tag to test your action in a workflow you configured inside the repository. However, if you don't delete / update the tag every time you update the action, the test will always use the same action implementation / version you generated the first time. My suggestion if to always use the branch you're using for the implementation to test the workflow, using the @branch reference.

    Here is an example using the main branch:

    jobs:
      test:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v3
          - uses: <owner>/<repo>@main