chindit / actions-phpcs

PHPCS action for GitHub
GNU General Public License v3.0
0 stars 3 forks source link

ERROR: You must supply at least one file or directory to process. #1

Closed bu4ak closed 4 years ago

bu4ak commented 4 years ago

actions output image


my config (default)

name: phpcs
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: PHP Code Style (phpcs)
      uses: chindit/actions-phpcs@1.0.1
      with:
        # Folder to check code style
        dir: .
chindit commented 4 years ago

Do you have a phpunit.xml.dist on your project ?

For example, I use this one:

<?xml version="1.0" encoding="UTF-8"?>

<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">

    <arg name="basepath" value="."/>
    <arg name="cache" value=".phpcs-cache"/>
    <arg name="colors"/>
    <arg name="extensions" value="php"/>

    <rule ref="ruleset.xml"/>

    <file>bin/</file>
    <file>config/</file>
    <file>public/</file>
    <file>src/</file>

</ruleset>
bu4ak commented 4 years ago

Yes i have

chindit commented 4 years ago

Ok, can you try a build with this branch ? uses: chindit/actions-phpcs@debug/missing_directory

If it works, I'll make a new release

bu4ak commented 4 years ago
name: phpcs
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: PHP Code Style (phpcs)
      uses: chindit/actions-phpcs@debug/missing_directory
      with:
        # Folder to check code style
        dir: src/

phpunit.xml.dist

<?xml version="1.0" encoding="UTF-8"?>

<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">

    <arg name="basepath" value="."/>
    <arg name="cache" value=".phpcs-cache"/>
    <arg name="colors"/>
    <arg name="extensions" value="php"/>

    <rule ref="ruleset.xml"/>

    <file>bin/</file>
    <file>config/</file>
    <file>public/</file>
    <file>src/</file>

</ruleset>


image

chindit commented 4 years ago

Ok, problem reproduced. I'm on it.

P.S.: Of course, config file should be named phpcs.xml.dist and not phpunit.xml.dist. My bad.

chindit commented 4 years ago

Ok, I got your problem. Action is crashing because you haven't checked out the code.

You must add this line before :

- uses: actions/checkout@v2

Your file will look like this:

name: phpcs
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: PHP Code Style (phpcs)
        uses: chindit/actions-phpcs@master
        with:
          # Folder to check code style
          dir: src/

As far as I know, there is actually no way for an action to require another action. So, chindit/actions-phpcs cannot require checkout, but I will update README.md

Let me know if you still have an issue.