-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
136 lines (117 loc) · 4.28 KB
/
validation.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Validation
on:
pull_request_target:
push:
branches: [main]
paths:
- "domains/*"
- "tests/*"
- "utils/*"
- ".github/workflows/validation.yml"
- "dnsconfig.js"
workflow_dispatch:
concurrency:
group: ${{ github.ref }}-validation
cancel-in-progress: true
jobs:
dns:
name: DNS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- id: create_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
- name: Check DNS
id: dns_check
uses: is-a-dev/dnscontrol-action@main
with:
args: check
config_file: "dnsconfig.js"
- name: Add Validated DNS Label
if: ${{ github.event_name == 'pull_request' && steps.dns_check.outcome == 'success' }}
uses: actions-ecosystem/action-add-labels@v1
with:
labels: "Validated DNS"
github_token: ${{ steps.create_token.outputs.token }}
issue_number: ${{ github.event.pull_request.number }}
- name: Remove Invalid DNS Label
if: ${{ github.event_name == 'pull_request' && steps.dns_check.outcome == 'success' }}
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "Invalid DNS"
github_token: ${{ steps.create_token.outputs.token }}
issue_number: ${{ github.event.pull_request.number }}
- name: Add Invalid DNS Label
if: ${{ github.event_name == 'pull_request' && failure() }}
uses: actions-ecosystem/action-add-labels@v1
with:
labels: "Invalid DNS"
github_token: ${{ steps.create_token.outputs.token }}
issue_number: ${{ github.event.pull_request.number }}
- name: Remove Validated DNS Label
if: ${{ github.event_name == 'pull_request' && failure() }}
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "Validated DNS"
github_token: ${{ steps.create_token.outputs.token }}
issue_number: ${{ github.event.pull_request.number }}
json:
name: JSON
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- id: create_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
- name: JSON Syntax Check
id: json_check
uses: limitusus/json-syntax-check@v2
with:
pattern: "\\.json$"
env:
BASE: "domains/"
- name: Add Validated JSON Label
if: ${{ github.event_name == 'pull_request' && steps.json_check.outcome == 'success' }}
uses: actions-ecosystem/action-add-labels@v1
with:
labels: "Validated JSON"
github_token: ${{ steps.create_token.outputs.token }}
issue_number: ${{ github.event.pull_request.number }}
- name: Remove Invalid JSON Label
if: ${{ github.event_name == 'pull_request' && steps.json_check.outcome == 'success' }}
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "Invalid JSON"
github_token: ${{ steps.create_token.outputs.token }}
issue_number: ${{ github.event.pull_request.number }}
- name: Add Invalid JSON Label
if: ${{ github.event_name == 'pull_request' && failure() }}
uses: actions-ecosystem/action-add-labels@v1
with:
labels: "Invalid JSON"
github_token: ${{ steps.create_token.outputs.token }}
issue_number: ${{ github.event.pull_request.number }}
- name: Remove Validated JSON Label
if: ${{ github.event_name == 'pull_request' && failure() }}
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "Validated JSON"
github_token: ${{ steps.create_token.outputs.token }}
issue_number: ${{ github.event.pull_request.number }}
tests:
name: Tests
if: "!contains(github.event.head_commit.message, '[skip-ci]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm install
- run: npm test