name: "Coding Standards"

on:
  pull_request:

jobs:
  coding-standards:
    name: "Coding Standards"
    runs-on: "ubuntu-latest"

    strategy:
      matrix:
        php-version:
          - "7.4"

    steps:
      - name: "Checkout"
        uses: "actions/checkout@v2"
        with:
          fetch-depth: 10

      - name: "Install PHP"
        uses: "shivammathur/setup-php@v2"
        with:
          coverage: "none"
          php-version: "${{ matrix.php-version }}"
          tools: "cs2pr"

      - name: "Install dependencies with Composer"
        uses: "ramsey/composer-install@v1"

      - name: "Install diff-sniffer"
        run: "wget https://github.com/diff-sniffer/diff-sniffer/releases/download/0.5.1/diff-sniffer.phar"

      - name: "Fetch head branch"
        run: "git remote set-branches --add origin $GITHUB_BASE_REF && git fetch origin $GITHUB_BASE_REF"

      - name: "Run diff-sniffer"
        run: "php diff-sniffer.phar origin/$GITHUB_BASE_REF...$GITHUB_SHA --report=checkstyle | cs2pr"

      - name: "Run phpcbf"
        run: "vendor/bin/phpcbf"


name: "Coding Standards"

on:
  pull_request:
    branches:
      - "*.x"
  push:
    branches:
      - "*.x"

jobs:
  coding-standards:
    name: "Coding Standards"
    runs-on: "ubuntu-20.04"

    strategy:
      matrix:
        php-version:
          - "7.4"

    steps:
      - name: "Checkout"
        uses: "actions/checkout@v2"

      - name: "Install PHP"
        uses: "shivammathur/setup-php@v2"
        with:
          coverage: "none"
          php-version: "${{ matrix.php-version }}"
          tools: "cs2pr"

      - name: "Install dependencies with Composer"
        uses: "ramsey/composer-install@v1"
        with:
          dependency-versions: "highest"

      # https://github.com/doctrine/.github/issues/3
      - name: "Run PHP_CodeSniffer"
        run: "vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr"

Synchronize coding standard workflow with upstream
Synchronize coding standard workflow with upstream

Now that there no longer are cs issues, we can thank diff-sniffer and
kiss it goodbye!
