Skip to content

Commit

Permalink
split jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
eldcn committed May 28, 2024
1 parent be7021f commit ba5d86d
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ concurrency:
cancel-in-progress: true

jobs:
detekt:
detekt-review:
name: Detekt review
runs-on: ubuntu-latest

outputs:
detekt-logs: ${{ steps.detekt-pr-check.outputs.detekt-logs }}
steps:
- name: checkout
uses: actions/checkout@v2
Expand All @@ -21,15 +22,27 @@ jobs:
ref: ${{ github.head_ref }}

- name: detekt-pr-check
id: detekt
id: detekt-pr-check
uses: alaegin/Detekt-Action@v1.23.6
with:
reviewdog_reporter: github-pr-check
github_token: ${{ secrets.github_token }}
detekt_config: internal/detekt-config.yml
- name: detekt-evaluate
# Capture the standard output and standard error as detekt-logs output
env:
DETEKT_LOGS: ${{ steps.detekt-pr-check.outputs.stdout }}${{ steps.detekt-pr-check.outputs.stderr }}
run: |
echo "::set-output name=detekt-logs::$DETEKT_LOGS"
detekt-evaluate:
name: Evaluate Detekt Logs
runs-on: ubuntu-latest
needs: [detekt-review]
steps:
- name: Check Detekt Logs
id: check-detekt-logs
run: |
detekt_logs="${{ steps.detekt.outputs.stdout }}"
detekt_logs="${{ needs.detekt-review.outputs.detekt-logs }}"
if grep -qE "(Analysis failed|conclusion=failure)" <(echo "$detekt_logs"); then
echo "Detekt analysis failed" >&2
exit 1
Expand All @@ -41,7 +54,7 @@ jobs:
check:
name: Build and test
needs: [detekt]
needs: [detekt-evaluate]
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down

0 comments on commit ba5d86d

Please sign in to comment.