Skip to content

Commit 13601ac

Browse files
committed
fix: simplify reporter type and checkout depth determination in PR workflow
1 parent 806c182 commit 13601ac

1 file changed

Lines changed: 12 additions & 19 deletions

File tree

.github/workflows/pr.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,19 @@ jobs:
2828
runs-on: fusion-gh-runner-fusion-framework
2929
env:
3030
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
31+
REVIEWDOG_REPORTER: ${{ (github.event.pull_request.draft && 'github-pr-check') || 'github-pr-review' }}
32+
CHECKOUT_FETCH_DEPTH: ${{ (github.actor != 'dependabot[bot]' && '0') || '1' }}
3133
steps:
32-
- name: Determin reporter type
33-
uses: haya14busa/action-cond@v1
34-
id: reporter
35-
with:
36-
cond: ${{ github.event.pull_request.draft }}
37-
if_true: "github-pr-check"
38-
if_false: "github-pr-review"
39-
40-
- name: Determine Checkout Depth
41-
uses: haya14busa/action-cond@v1
42-
id: fetch-depth
43-
with:
44-
cond: ${{ github.actor != 'dependabot[bot]' }}
45-
if_true: '0'
46-
if_false: '1'
4734
- uses: actions/checkout@v7
4835
with:
4936
ref: "${{ github.event.pull_request.head.sha }}"
50-
fetch-depth: ${{ steps.fetch-depth.outputs.value }}
37+
fetch-depth: ${{ env.CHECKOUT_FETCH_DEPTH }}
38+
39+
# fusion-gh-runner-fusion-framework's image doesn't ship gh (tracked with
40+
# infra); install it until the runner image is patched.
41+
- name: Setup fusion runner
42+
continue-on-error: true
43+
uses: ./.github/actions/setup-fusion-runner
5144

5245
- name: Setup node and install deps
5346
uses: ./.github/actions/node-setup
@@ -85,7 +78,7 @@ jobs:
8578
uses: mongolyy/reviewdog-action-biome@v2
8679
with:
8780
github_token: ${{ github.token }}
88-
reporter: ${{ steps.reporter.outputs.value }}
81+
reporter: ${{ env.REVIEWDOG_REPORTER }}
8982
level: error
9083

9184
- name: Build fusion-lint
@@ -99,7 +92,7 @@ jobs:
9992
| reviewdog \
10093
-name="fusion-lint" \
10194
-f=rdjsonl \
102-
-reporter=${{ steps.reporter.outputs.value }} \
95+
-reporter=${{ env.REVIEWDOG_REPORTER }} \
10396
-fail-level=error
10497
10598
- name: Build affected packages
@@ -118,7 +111,7 @@ jobs:
118111
path: tsc-build.log
119112

120113
- name: Review build log
121-
run: cat tsc-build.log | reviewdog -name=tsc -f=tsc -reporter=${{ steps.reporter.outputs.value }} -fail-level=error
114+
run: cat tsc-build.log | reviewdog -name=tsc -f=tsc -reporter=${{ env.REVIEWDOG_REPORTER }} -fail-level=error
122115

123116
- name: Check if build failed
124117
if: steps.build.outcome == 'failure'

0 commit comments

Comments
 (0)