OskarStark / phpcs-ga

GithubAction for phpcs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No files detected by phpcs

nick-f opened this issue · comments

Hi there,

I've copied the example and followed the readme, but I keep seeing the following error when the action runs.

Abbreviated output:

Pulling image: gcr.io/github-actions-images/action-runner:latest
latest: Pulling from github-actions-images/action-runner
[...]
Status: Downloaded newer image for gcr.io/github-actions-images/action-runner:latest
Unable to find image 'oskarstark/phpcs-ga:latest' locally
latest: Pulling from oskarstark/phpcs-ga
[...]
Status: Downloaded newer image for oskarstark/phpcs-ga:latest
ERROR: You must supply at least one file or directory to process.

Run "phpcs --help" for usage information

Any thoughts on what could be the cause?

Hi @nick-f 👋

I think the example is a bit misleading, can you try something like this locally in your project dir?

docker run --rm -it -w=/app -v ${PWD}:/app oskarstark/phpcs-ga:latest src

to scan the whole project this should work:
docker run --rm -it -w=/app -v ${PWD}:/app oskarstark/phpcs-ga:latest /app

if it fixes you need to append the path in your GithubAction config like this:

action "PHPCS" {
  uses = "docker://oskarstark/phpcs-ga"
  secrets = ["GITHUB_TOKEN"]
+  args = "/app"
}

Please tell if its working! 🌞

Thanks for your quick reply, @OskarStark!

I was able to get it working locally with the necessary args pointing to the files.

For future internet travellers, I'm only passing in files that I have created and it runs speedily.

For example in my Laravel project, args is set to:

app/*.php app/Http/Controllers/ app/Nova/ app/Scopes/

So no vendor or framework directories.

Now to go fix the problems that it found 😅

Nice 💯

It would be nice, if this only runs on changed files...

Maybe github is exposing them to the action/dockerimage