Skip to content

Commit a35523f

Browse files
committed
init
0 parents  commit a35523f

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

.github/workflows/review.yml

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: review
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
pr:
7+
description: "Pull Request Number"
8+
required: true
9+
type: number
10+
nixpkgs-review:
11+
description: "nixpkgs-review flake"
12+
required: true
13+
type: string
14+
default: github:Mic92/nixpkgs-review
15+
x86_64-linux:
16+
description: "Run on x86_64-linux"
17+
required: true
18+
type: boolean
19+
default: true
20+
aarch64-linux:
21+
description: "Run on aarch64-linux"
22+
required: true
23+
type: boolean
24+
default: true
25+
x86_64-darwin:
26+
description: "Run on x86_64-darwin"
27+
required: true
28+
type: boolean
29+
default: true
30+
aarch64-darwin:
31+
description: "Run on aarch64-darwin"
32+
required: true
33+
type: boolean
34+
default: true
35+
post-result:
36+
description: "Post Result"
37+
required: true
38+
type: boolean
39+
default: true
40+
41+
jobs:
42+
review:
43+
strategy:
44+
matrix:
45+
system:
46+
- x86_64-linux
47+
- aarch64-linux
48+
- x86_64-darwin
49+
- aarch64-darwin
50+
exclude:
51+
- system: ${{ !inputs.x86_64-linux && 'x86_64-linux' || '' }}
52+
- system: ${{ !inputs.aarch64-linux && 'aarch64-linux' || '' }}
53+
- system: ${{ !inputs.x86_64-darwin && 'x86_64-darwin' || '' }}
54+
- system: ${{ !inputs.aarch64-darwin && 'aarch64-darwin' || '' }}
55+
fail-fast: false
56+
runs-on: >-
57+
${{ (matrix.system == 'x86_64-linux' && 'ubuntu-latest')
58+
|| (matrix.system == 'aarch64-linux' && 'ubuntu-24.04-arm')
59+
|| (matrix.system == 'x86_64-darwin' && 'macos-13')
60+
|| (matrix.system == 'aarch64-darwin' && 'macos-latest') }}
61+
outputs:
62+
report_x86_64-linux: ${{ steps.report.outputs.report_x86_64-linux }}
63+
report_aarch64-linux: ${{ steps.report.outputs.report_aarch64-linux }}
64+
report_x86_64-darwin: ${{ steps.report.outputs.report_x86_64-darwin }}
65+
report_aarch64-darwin: ${{ steps.report.outputs.report_aarch64-darwin }}
66+
steps:
67+
- uses: DeterminateSystems/nix-installer-action@v16
68+
- uses: actions/checkout@v4
69+
with:
70+
repository: NixOS/nixpkgs
71+
- run: nix run ${{ inputs.nixpkgs-review }} -- pr ${{ inputs.pr }} --no-shell
72+
env:
73+
GITHUB_TOKEN: ${{ github.token }}
74+
- run: echo report_${{ matrix.system }}=$(sed -e '1i\\n---' -e '1,/^---/d' ~/.cache/nixpkgs-review/pr-${{ inputs.pr }}/report.md | base64 -w0) >> "$GITHUB_OUTPUT"
75+
id: report
76+
77+
report:
78+
runs-on: ubuntu-latest
79+
needs: [review]
80+
outputs:
81+
report: ${{ steps.report.outputs.report }}
82+
steps:
83+
- id: report
84+
run: |
85+
cat << EOF > report.md
86+
## \`nixpkgs-review\` result
87+
88+
Generated using [\`nixpkgs-review\`](https://github.com/Mic92/nixpkgs-review).
89+
90+
Command: \`nixpkgs-review pr ${{ inputs.pr }}\`
91+
92+
Logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
93+
EOF
94+
95+
echo ${{ needs.review.outputs.report_x86_64-linux }} | base64 -d >> report.md
96+
echo ${{ needs.review.outputs.report_aarch64-linux }} | base64 -d >> report.md
97+
echo ${{ needs.review.outputs.report_x86_64-darwin }} | base64 -d >> report.md
98+
echo ${{ needs.review.outputs.report_aarch64-darwin }} | base64 -d >> report.md
99+
100+
cat report.md
101+
echo report=$(base64 -w0 report.md) >> "$GITHUB_OUTPUT"
102+
103+
post-result:
104+
runs-on: ubuntu-latest
105+
needs: [report]
106+
if: ${{ inputs.post-result }}
107+
environment: post-result
108+
steps:
109+
- run: echo ${{ needs.report.outputs.report }} | base64 -d > report.md
110+
- run: gh pr -R EloDef/test comment 1 -F report.md
111+
env:
112+
GH_TOKEN: ${{ secrets.GH_TOKEN }}

0 commit comments

Comments
 (0)