Skip to content

Check PR complains with requirements #10

Check PR complains with requirements

Check PR complains with requirements #10

name: "Check PR complains with requirements"
on:
pull_request_target:
workflow_run:
workflows: ['Run tests for PR']
types: [completed]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.workflow_run.head_branch }}
cancel-in-progress: true
jobs:
restore-pr:
if: github.event_name == 'workflow_run'
runs-on: ubuntu-latest
outputs:
pr-number: ${{ steps.pr-info.outputs.pr-number }}
steps:
- name: Download PR info
uses: dawidd6/action-download-artifact@v6
with:
name: pr_number
path: pr/
run_id: ${{ github.event.workflow_run.id }}
- name: Store PR number
id: pr-info
run: echo "pr-number=$(cat pr/pr_number)" >> $GITHUB_OUTPUT
reviewdog:
if: github.event_name == 'workflow_run'
needs:
- restore-pr
strategy:
matrix:
include:
- tool: ktlint
error-format: "%f:%l:%c %m"
- tool: detekt
error-format: "%f:%l:%c: %m"
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: Download style reports
uses: dawidd6/action-download-artifact@v6
with:
name: style-reports
path: reports/
run_id: ${{ github.event.workflow_run.id }}
- name: Setup reviewdog
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- name: Run reviewdog ${{ matrix.tool }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI_PULL_REQUEST: ${{ needs.restore-pr.outputs.pr-number }}
CI_REPO_OWNER: ${{ github.repository_owner }}
CI_REPO_NAME: ${{ github.event.repository.name }}
CI_COMMIT: ${{ github.event.workflow_run.head_sha }}
run: echo reports/${{ matrix.tool }}-reviewdog.out | reviewdog -tee -reporter=github-pr-review -name=${{ matrix.tool }} -efm="${{ matrix.error-format }}"
danger-check:
if: github.event_name == 'pull_request_target'
runs-on: ubuntu-latest
permissions:
pull-requests: write
statuses: write
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: Danger
uses: danger/[email protected]
with:
run-mode: ci
dangerfile: Dangerfile.df.kts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
upload-coverage:
runs-on: ubuntu-latest
if: github.event.workflow_run.actor.name != 'dependabot[bot]' && github.event.workflow_run.conclusion == 'success'
needs:
- restore-pr
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
with:
repository: ${{ github.event.workflow_run.head_repository.full_name }}
ref: ${{ github.event.workflow_run.head_sha }}
- name: Download benchmark results
uses: dawidd6/action-download-artifact@v6
with:
name: coverage-reports
path: reports/
run_id: ${{ github.event.workflow_run.id }}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
override_branch: ${{ github.event.workflow_run.head_branch }}
override_commit: ${{ github.event.workflow_run.head_sha }}
override_pr: ${{ needs.restore-pr.outputs.pr-number }}
token: ${{ secrets.CODECOV_TOKEN }}