Skip to content

Workflow never fails #87

@chrisc-cy2

Description

@chrisc-cy2

I've tried everything I can think of, but it looks like it's impossible to get this workflow action to fail.

Here's my workflow:

name: CodingStandards
on:
  pull_request:
    paths:
      - "**.php"
      - "phpcs.xml"
      - ".github/workflows/phpcs.yml"
jobs:

  phpcs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Install PHP_CodeSniffer
        run: |
          curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
          php phpcs.phar --version

      - uses: tinovyatkin/action-php-codesniffer@v1
        with:
          files: "**.php"
          phpcs_path: "php phpcs.phar --colors -v -vv"
          standard: "PSR12"
          scope: "file"

This just passes every time whether or not there's changed files with coding standards violations in them.

Here's the output:

Run tinovyatkin/action-php-codesniffer@v1
  with:
    files: **.php
    phpcs_path: php phpcs.phar --colors -v -vv
    standard: PSR12
    scope: file
Filter patterns: [ '**.php' ] true
{
  "added": [],
  "modified": [
    "app/Http/Controllers/Controller.php"
  ]
}

I've tried:

  • Using a phpcs.xml file with PSR12 standards
  • Putting PSR12 in quotes and not in quotes
  • Using scope file and omitting scope
  • Adding options to phpcs_path and using without options
  • Adding various PSR12 violations to the file in question
  • Using various forks of this repo in the hope one of them works

It's hard to tell what the output of the action should be. I would expect to see phpcs output but it looks like it's only printing a JSON object of changed files, so I don't know if it's actually running phpcs or not... if it's not running, that would explain why it's not failing, but I can't tell.

It's definitely recognising the modified file, and it definitely matches the glob in the filter pattern.

These are definitely coding standards violations because running phpcs manually at my end, the warnings do appear.

As mentioned, I think I've ruled out everything I can. Are there any other steps I can use to debug this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions