-
Notifications
You must be signed in to change notification settings - Fork 39
60 lines (58 loc) · 2.18 KB
/
pull-request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Organize pull requests
on:
pull_request_target:
types: [opened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
lint:
# Never ever ever run this on self-hosted runners
runs-on: ubuntu-latest # Did you read the disclaimer?
outputs:
fmt: ${{ steps.linter.outcome }}
steps:
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
accept-flake-config = true
system-features = big-parallel gccarch-x86-64-v3
nix_path: "nixpkgs=channel:nixpkgs-unstable"
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Run linter
run: nix develop ./maintenance#linter -c 'chaotic-nyx-lint'
id: linter
working-directory: ${{ github.workspace }}
organize:
# Never ever ever run this on self-hosted runners
runs-on: ubuntu-latest # Did you read the disclaimer?
permissions:
pull-requests: write
needs: lint
if: (!cancelled() && (contains(github.event.pull_request.labels.*.name, 'cached') || (needs.lint.outputs.fmt == 'failure' && github.event.action == 'opened')))
steps:
- name: Add comment
if: needs.lint.outputs.fmt == 'failure' && github.event.action == 'opened'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Thank you for contributing to nyx! Please run `nix fmt` on your code before submitting a pull request. Afterwards, please force push your changes."
})
- name: Remove cached label
if: contains(github.event.pull_request.labels.*.name, 'cached')
uses: actions/github-script@v7
with:
script: |
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: "cached"
})