Skip to content

Commit 6227753

Browse files
Add review-wrapper
1 parent 409a1c0 commit 6227753

File tree

2 files changed

+66
-29
lines changed

2 files changed

+66
-29
lines changed

.github/workflows/ci-review-trigger.yml

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -84,41 +84,16 @@ jobs:
8484
if: steps.comment.outputs.isTeamMember == 'false'
8585
run: exit 1
8686

87-
set-cli-pending:
87+
cli:
8888
needs: validate
8989
if: startsWith(github.event.review.body, '/ci-run-all') || contains(github.event.review.body, '/ci-run-cli')
90-
runs-on: ubuntu-24.04
91-
timeout-minutes: 5
92-
steps:
93-
- name: Set commit status as pending
94-
uses: myrotvorets/set-commit-status-action@3730c0a348a2ace3c110851bed53331bc6406e9f # v2.0.1
95-
with:
96-
sha: ${{ github.event.review.commit_id }}
97-
token: ${{ secrets.GITHUB_TOKEN }}
98-
context: CLI - Linux
99-
status: pending
100-
101-
cli:
102-
needs: set-cli-pending
103-
uses: ./.github/workflows/cli.yml
90+
uses: ./.github/workflows/review-wrapper.yml
10491
with:
92+
workflow: ./.github/workflows/cli.yml
93+
context: CLI - Linux
10594
ref: ${{ github.event.review.commit_id }}
10695
secrets: inherit
10796

108-
set-cli-status:
109-
needs: cli
110-
if: always()
111-
runs-on: ubuntu-24.04
112-
timeout-minutes: 5
113-
steps:
114-
- name: Set commit status as ${{ needs.cli.result }}
115-
uses: myrotvorets/set-commit-status-action@3730c0a348a2ace3c110851bed53331bc6406e9f # v2.0.1
116-
with:
117-
sha: ${{ github.event.review.commit_id }}
118-
token: ${{ secrets.GITHUB_TOKEN }}
119-
context: CLI - Linux
120-
status: ${{ needs.cli.result }}
121-
12297
make-test-behavior:
12398
needs: validate
12499
if: startsWith(github.event.review.body, '/ci-run-all') || contains(github.event.review.body, '/ci-run-test-behavior')
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Review Wrapper
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
workflow:
7+
description: 'Workflow to call (e.g., ./.github/workflows/cli.yml)'
8+
required: true
9+
type: string
10+
context:
11+
description: 'Status check context name (e.g., CLI - Linux)'
12+
required: true
13+
type: string
14+
ref:
15+
description: 'Git ref to checkout'
16+
required: true
17+
type: string
18+
19+
permissions:
20+
statuses: write
21+
22+
jobs:
23+
set-pending:
24+
runs-on: ubuntu-24.04
25+
timeout-minutes: 5
26+
permissions:
27+
pull-requests: read
28+
statuses: write
29+
steps:
30+
- name: Set commit status as pending
31+
uses: myrotvorets/set-commit-status-action@3730c0a348a2ace3c110851bed53331bc6406e9f # v2.0.1
32+
with:
33+
sha: ${{ inputs.ref }}
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
context: ${{ inputs.context }}
36+
status: pending
37+
38+
run-workflow:
39+
needs: set-pending
40+
uses: ${{ inputs.workflow }}
41+
with:
42+
ref: ${{ inputs.ref }}
43+
secrets: inherit
44+
45+
set-final-status:
46+
needs: run-workflow
47+
if: always()
48+
49+
runs-on: ubuntu-24.04
50+
timeout-minutes: 5
51+
52+
permissions:
53+
pull-requests: read
54+
statuses: write
55+
steps:
56+
- name: Set commit status as ${{ needs.run-workflow.result }}
57+
uses: myrotvorets/set-commit-status-action@3730c0a348a2ace3c110851bed53331bc6406e9f # v2.0.1
58+
with:
59+
sha: ${{ inputs.ref }}
60+
token: ${{ secrets.GITHUB_TOKEN }}
61+
context: ${{ inputs.context }}
62+
status: ${{ needs.run-workflow.result }}

0 commit comments

Comments
 (0)