Skip to content

Commit 0e669a0

Browse files
committed
init
0 parents  commit 0e669a0

File tree

3 files changed

+148
-0
lines changed

3 files changed

+148
-0
lines changed

.github/workflows/review.yml

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
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+
x86_64-linux:
11+
description: "Run on x86_64-linux"
12+
required: true
13+
type: boolean
14+
default: true
15+
aarch64-linux:
16+
description: "Run on aarch64-linux"
17+
required: true
18+
type: boolean
19+
default: true
20+
x86_64-darwin:
21+
description: "Run on x86_64-darwin"
22+
required: true
23+
type: boolean
24+
default: true
25+
aarch64-darwin:
26+
description: "Run on aarch64-darwin"
27+
required: true
28+
type: boolean
29+
default: true
30+
tmate:
31+
description: "Start tmate session after nixpkgs-review"
32+
required: true
33+
type: boolean
34+
default: false
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+
- name: install nix
68+
uses: DeterminateSystems/nix-installer-action@v16
69+
- name: clone nixpkgs
70+
uses: actions/checkout@v4
71+
with:
72+
repository: NixOS/nixpkgs
73+
- name: run nixpkgs-review
74+
run: nix run .#nixpkgs-review -- pr ${{ inputs.pr }} --no-shell --print-result --build-args="-L"
75+
env:
76+
GITHUB_TOKEN: ${{ github.token }}
77+
- name: start tmate session
78+
uses: mxschmitt/action-tmate@v3
79+
- name: generate report
80+
id: report
81+
run: |
82+
sed=$(nix build --no-link --print-out-paths .#gnused)/bin/sed
83+
base64=$(nix build --no-link --print-out-paths .#coreutils)/bin/base64
84+
echo report_${{ matrix.system }}=$($sed -e '1i\\n---' -e '1,/^---/d' ~/.cache/nixpkgs-review/pr-${{ inputs.pr }}/report.md | $base64 -w0) >> "$GITHUB_OUTPUT"
85+
86+
report:
87+
runs-on: ubuntu-latest
88+
needs: [review]
89+
outputs:
90+
report: ${{ steps.report.outputs.report }}
91+
steps:
92+
- name: generate report
93+
id: report
94+
run: |
95+
cat << EOF > report.md
96+
## \`nixpkgs-review\` result
97+
98+
Generated using [\`nixpkgs-review\`](https://github.com/Mic92/nixpkgs-review).
99+
100+
Command: \`nixpkgs-review pr ${{ inputs.pr }}\`
101+
102+
Logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
103+
EOF
104+
105+
echo ${{ needs.review.outputs.report_x86_64-linux }} | base64 -d >> report.md
106+
echo ${{ needs.review.outputs.report_aarch64-linux }} | base64 -d >> report.md
107+
echo ${{ needs.review.outputs.report_x86_64-darwin }} | base64 -d >> report.md
108+
echo ${{ needs.review.outputs.report_aarch64-darwin }} | base64 -d >> report.md
109+
110+
cat report.md
111+
echo report=$(base64 -w0 report.md) >> "$GITHUB_OUTPUT"
112+
113+
post-result:
114+
runs-on: ubuntu-latest
115+
needs: [report]
116+
if: ${{ inputs.post-result }}
117+
environment: post-result
118+
steps:
119+
- name: fetch report
120+
run: echo ${{ needs.report.outputs.report }} | base64 -d > report.md
121+
- name: post comment
122+
run: gh pr -R NixOS/nixpkgs comment ${{ inputs.pr }} -F report.md
123+
env:
124+
GH_TOKEN: ${{ secrets.GH_TOKEN }}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Felix Bargfeldt
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# nixpkgs-review-gha
2+
3+
Run [nixpkgs-review](https://github.com/Mic92/nixpkgs-review) in GitHub Actions

0 commit comments

Comments
 (0)