Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comment after php-smelly-code-detector summary #282

Open
abenevaut opened this issue Dec 21, 2024 · 0 comments
Open

Add comment after php-smelly-code-detector summary #282

abenevaut opened this issue Dec 21, 2024 · 0 comments

Comments

@abenevaut
Copy link
Owner

      - name: Smelly Code Detector
        if: github.event_name == 'pull_request' && matrix.record_coverage
        run: |
          vendor/bin/smelly-code-detector inspect src | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]//g" > tmp.txt
          sed '$d' tmp.txt > tmp2.txt
          sed '$d' tmp2.txt > tmp.txt
          sed '2d' tmp.txt > tmp2.txt
          sed '2d' tmp2.txt > tmp.txt
          sed '2d' tmp.txt > tmp2.txt
          sed 's/+/|/g' tmp2.txt > ../.github/workflows/smelly-code-detector.txt
          rm tmp.txt tmp2.txt

      - uses: actions/upload-artifact@v4
        with:
          name: smelly-code-detector
          path: ${{ github.workspace }}/.github/workflows/smelly-code-detector.txt
          retention-days: 1
          compression-level: 9
          overwrite: true
  comment:
    runs-on: ubuntu-latest
    needs: test
    permissions:
      # needed by `NejcZdovc/comment-pr` action
      pull-requests: write
    strategy:
      fail-fast: true
      matrix:
        php_version: [ 83, 84 ]
        include:
          - php_version: 83
            record_coverage: true
          - php_version: 84
            record_coverage: false
    concurrency:
      group: laravel-sentry-handler-comment-${{ github.workflow }}-${{ github.ref }}-${{ matrix.php_version }}
      cancel-in-progress: false
    steps:

      - uses: actions/download-artifact@v4
        if: github.event_name == 'pull_request' && matrix.record_coverage
        with:
          name: smelly-code-detector
          path: ${{ github.workspace }}/.github/workflows

      - uses: NejcZdovc/comment-pr@v2
        if: github.event_name == 'pull_request' && matrix.record_coverage
        with:
          file: smelly-code-detector.txt
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant