swaggest/php-json-schema

View on GitHub
.github/workflows/cloc.yml

Summary

Maintainability
Test Coverage
name: cloc
on:
  pull_request:

# Cancel the workflow in progress in newer build is about to start.
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  cloc:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          path: pr
      - name: Checkout base code
        uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.base.sha }}
          path: base
      - name: Count Lines Of Code
        id: loc
        run: |
          curl -sLO https://github.com/vearutop/sccdiff/releases/download/v1.0.2/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && echo "b17e76bede22af0206b4918d3b3c4e7357f2a21b57f8de9e7c9dc0eb56b676c0  sccdiff" | shasum -c
          OUTPUT=$(cd pr && ../sccdiff -basedir ../base)
          echo "${OUTPUT}"
          OUTPUT="${OUTPUT//$'\n'/%0A}"
          echo "::set-output name=diff::$OUTPUT"

      - name: Comment Code Lines
        continue-on-error: true
        uses: marocchino/sticky-pull-request-comment@v2
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          header: LOC
          message: |
            ### Lines Of Code

            ${{ steps.loc.outputs.diff }}