File tree Expand file tree Collapse file tree 5 files changed +174
-0
lines changed
Expand file tree Collapse file tree 5 files changed +174
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Auto review
2+ on :
3+ workflow_run :
4+ workflows : [Build check]
5+ types :
6+ - completed
7+
8+ jobs :
9+ run-test :
10+ runs-on : ubuntu-latest
11+ if : ${{ github.event.workflow_run.conclusion == 'success' }}
12+ steps :
13+ - uses : actions/checkout@v3.3.0
14+
15+ - name : Download artifact
16+ id : download-artifact
17+ uses : dawidd6/action-download-artifact@v2
18+ with :
19+ workflow : build-check.yml
20+ workflow_conclusion : success
21+ name : pr-number
22+ path : artifacts
23+
24+ - name : Set PR number
25+ id : pr-number
26+ run : echo pr-number=$(cat ./artifacts/pr-number.txt) >> $GITHUB_OUTPUT
27+
28+ - name : PR review and merge
29+ env :
30+ GITHUB_TOKEN : ${{ github.token }}
31+ run : |
32+ gh pr review --approve ${{ steps.pr-number.outputs.pr-number }}
33+ gh pr merge --merge --auto ${{ steps.pr-number.outputs.pr-number }}
34+
35+ on-failure :
36+ runs-on : ubuntu-latest
37+ if : ${{ github.event.workflow_run.conclusion == 'failure' }}
38+ steps :
39+ - uses : actions/checkout@v3.3.0
40+
41+ - name : Download artifact
42+ id : download-artifact
43+ uses : dawidd6/action-download-artifact@v2
44+ with :
45+ workflow : build-check.yml
46+ workflow_conclusion : success
47+ name : pr-number
48+ path : artifacts
49+
50+ - name : Set PR number
51+ id : pr-number
52+ run : echo pr-number=$(cat ./artifacts/pr-number.txt) >> $GITHUB_OUTPUT
53+
54+ - name : Close PR
55+ env :
56+ GITHUB_TOKEN : ${{ github.token }}
57+ run : gh pr close ${{ steps.pr-number.outputs.pr-number }}
Original file line number Diff line number Diff line change 1+ name : Build check
2+ on :
3+ pull_request :
4+
5+ jobs :
6+ build-check :
7+ runs-on : ubuntu-latest
8+ steps :
9+ - uses : easimon/maximize-build-space@master
10+ with :
11+ root-reserve-mb : 8192
12+ swap-size-mb : 1024
13+ build-mount-path : " /nix/store"
14+ remove-dotnet : true
15+ remove-android : true
16+ remove-haskell : true
17+ remove-codeql : true
18+ remove-docker-images : true
19+
20+ - uses : actions/checkout@v3.3.0
21+
22+ - name : Cache nvfetcher
23+ uses : actions/cache@v3.2.6
24+ with :
25+ path : ~/.local/share/nvfetcher
26+ key : ${{ runner.os }}-nvfetcher
27+
28+ - uses : cachix/install-nix-action@v20
29+ with :
30+ nix_path : nixpkgs=channel:nixos-unstable
31+
32+ - uses : cachix/cachix-action@v12
33+ with :
34+ name : misumisumi
35+ authToken : " ${{ secrets.CACHIX_AUTH_TOKEN }}"
36+ skipPush : true
37+
38+ - name : Run flake build
39+ run : nix flake check
40+
41+ - name : Save PR number
42+ run : echo $GITHUB_REF | sed -e 's/[^0-9]//g' > pr-number.txt
43+
44+ - name : Upload Artifact
45+ uses : actions/upload-artifact@v3
46+ with :
47+ name : pr-number
48+ path : pr-number.txt
49+ retention-days : 7
Original file line number Diff line number Diff line change 1+ name : Delete workflow
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ workflow :
7+ description : workflow-id, workflow-name or filename
8+ required : true
9+ type : string
10+
11+ jobs :
12+ delete :
13+ runs-on : ubuntu-20.04
14+ timeout-minutes : 1
15+ env :
16+ GH_TOKEN : ${{ github.token }}
17+ GH_REPO : ${{ github.repository }}
18+ WORKFLOW : ${{ github.event.inputs.workflow }}
19+
20+ steps :
21+ - run : gh workflow view "${WORKFLOW}"
22+ - run : |
23+ gh run list --workflow "${WORKFLOW}" --limit 1000 --json databaseId,status --jq '.[] | select(.status == "completed") | .databaseId' \
24+ | xargs -n 1 -I {} gh api -X DELETE repos/${REPOSITORY}/actions/runs/{}
25+ env:
26+ REPOSITORY: ${{ github.repository }}
Original file line number Diff line number Diff line change 1+ name : Format check
2+ on :
3+ push :
4+ branch-ignore :
5+ - " update_flake_lock_action"
6+ tags :
7+ - " *"
8+ paths :
9+ - " **.nix"
10+ pull_request :
11+
12+ jobs :
13+ nixpkgs-fmt :
14+ runs-on : ubuntu-latest
15+ steps :
16+ - uses : actions/checkout@v3
17+ - uses : cachix/install-nix-action@v22
18+ with :
19+ nix_path : nixpkgs=channel:nixos-unstable
20+ github_access_token : ${{ secrets.GITHUB_TOKEN }}
21+ - run : nix run nixpkgs#nixpkgs-fmt -- --check $(find ./ -type f -name "*.nix" | grep -v generated.nix)
Original file line number Diff line number Diff line change 1+ name : Style check
2+ on :
3+ push :
4+ branch-ignore :
5+ - " update_flake_lock_action"
6+ tags :
7+ - " *"
8+ paths :
9+ - " **.nix"
10+ pull_request :
11+
12+ jobs :
13+ statix :
14+ runs-on : ubuntu-latest
15+ steps :
16+ - uses : actions/checkout@v3
17+ - uses : cachix/install-nix-action@v22
18+ with :
19+ nix_path : nixpkgs=channel:nixos-unstable
20+ github_access_token : ${{ secrets.GITHUB_TOKEN }}
21+ - run : nix run nixpkgs#statix check
You can’t perform that action at this time.
0 commit comments