-
Notifications
You must be signed in to change notification settings - Fork 729
60 lines (52 loc) 路 1.87 KB
/
Copy pathvalidate.yml
File metadata and controls
60 lines (52 loc) 路 1.87 KB
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: json-yaml-validate
on:
push:
branches:
- main
pull_request_target:
merge_group:
workflow_dispatch:
permissions:
contents: read
pull-requests: write
jobs:
json-yaml-validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
allow-unsafe-pr-checkout: true
- name: json-yaml-validate
id: json-yaml-validate
uses: GrantBirki/json-yaml-validate@v5.0.0
with:
comment: "true"
sort-check:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request_target' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
allow-unsafe-pr-checkout: true
- uses: actions/setup-python@v7
with:
python-version: "3"
- name: Install dependencies
run: pip install natsort ruamel.yaml
- name: Check sort order
id: sort-check
run: python3 bin/sort-zones --check
- name: Comment on PR if unsorted
if: failure() && steps.sort-check.outcome == 'failure' && github.event_name == 'pull_request_target'
uses: actions/github-script@v9
with:
script: |
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
event: 'REQUEST_CHANGES',
body: '鈿狅笍 Your DNS record is not sorted in alphabetical order! Please sort it accordingly so your PR can be merged.\n\nSub-sub domains (ex: `badge.shipwrecked.hackclub.com`) should be sorted in alphabetical order under their respective parent subdomain (ex: `shipwrecked.hackclub.com`).'
})