Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script for formatting/sorting YAML files #1237

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions aisafety.dance.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
'':
- type: ALIAS
value: hackclub.github.io.

'www':
- type: CNAME
value: hackclub.github.io.
"":
- type: ALIAS
value: hackclub.github.io.
www:
- type: CNAME
value: hackclub.github.io.
102 changes: 51 additions & 51 deletions bank.engineering.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
---
"":
- ttl: 1
type: ALIAS
value: cname.vercel-dns.com.
- ttl: 1
type: MX
values:
- exchange: mx1.improvmx.com.
preference: 10
- exchange: mx2.improvmx.com.
preference: 20
- ttl: 1
type: TXT
values:
- v=spf1 include:spf.improvmx.com ~all
_acme-challenge.curl:
ttl: 1
type: CNAME
value: c82b414cd89d32fd90685ead._acme.deno.dev.
changelog:
ttl: 1
type: CNAME
value: headwayapp.co.
curl:
- ttl: 1
type: A
value: 34.120.54.55
- ttl: 1
type: AAAA
value: "2600:1901:0:6d85::"
gverify:
ttl: 1
type: CNAME
value: frozen-orange-67zbfnflol9wncm7vfgzr3bb.herokudns.com.
internal:
- ttl: 1
type: A
value: 138.197.18.43
maps:
- ttl: 1
type: CNAME
value: cname.vercel-dns.com.
www:
- ttl: 1
type: CNAME
value: cname.vercel-dns.com.
yellowpages:
- ttl: 1
type: CNAME
value: cname.vercel-dns.com.
---
"":
- ttl: 1
type: ALIAS
value: cname.vercel-dns.com.
- ttl: 1
type: MX
values:
- exchange: mx1.improvmx.com.
preference: 10
- exchange: mx2.improvmx.com.
preference: 20
- ttl: 1
type: TXT
values:
- v=spf1 include:spf.improvmx.com ~all
_acme-challenge.curl:
ttl: 1
type: CNAME
value: c82b414cd89d32fd90685ead._acme.deno.dev.
changelog:
ttl: 1
type: CNAME
value: headwayapp.co.
curl:
- ttl: 1
type: A
value: 34.120.54.55
- ttl: 1
type: AAAA
value: '2600:1901:0:6d85::'
gverify:
ttl: 1
type: CNAME
value: frozen-orange-67zbfnflol9wncm7vfgzr3bb.herokudns.com.
internal:
- ttl: 1
type: A
value: 138.197.18.43
maps:
- ttl: 1
type: CNAME
value: cname.vercel-dns.com.
www:
- ttl: 1
type: CNAME
value: cname.vercel-dns.com.
yellowpages:
- ttl: 1
type: CNAME
value: cname.vercel-dns.com.
19 changes: 19 additions & 0 deletions bin/format
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Get list of zones (and thus filenames)
yq '.zones | keys | .[]' config/production.yaml | while read -r zone; do
# For each file...
FILENAME="$zone"yaml
echo -e "\nFormatting $FILENAME"

# Print a diff (if changes are made)
yq -MP 'sort_keys(.)' $FILENAME >$FILENAME.tmp
diff -u $FILENAME $FILENAME.tmp | diffstat -q
rm $FILENAME.tmp

# Apply the changes
yq -iMP 'sort_keys(.)' $FILENAME
# - i: in-place
# - M: no color
# - P: pretty print
done
6 changes: 3 additions & 3 deletions bulckcah.com.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
? ''
: type: ALIAS
"":
type: ALIAS
value: proxyparty.hackclub.com.
"*":
'*':
type: CNAME
value: proxyparty.hackclub.com.
27 changes: 13 additions & 14 deletions cpu.land.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
---
'':
- type: A
ttl: 21600
value: 76.76.21.21
- type: TXT
ttl: 5
values:
- google-site-verification=yrBprsuPgbaoNFd79KLgjYMr2xqEZhkaTH6eZbYvsHg # google search console
- google-site-verification=KuU6_yKBnq6HLWIGl9z8FJTm9QERMFBkuhVnG7SxC5o # ahrefs

'www':
- type: CNAME
ttl: 21600
value: cname.vercel-dns.com.
"":
- type: A
ttl: 21600
value: 76.76.21.21
- type: TXT
ttl: 5
values:
- google-site-verification=yrBprsuPgbaoNFd79KLgjYMr2xqEZhkaTH6eZbYvsHg # google search console
- google-site-verification=KuU6_yKBnq6HLWIGl9z8FJTm9QERMFBkuhVnG7SxC5o # ahrefs
www:
- type: CNAME
ttl: 21600
value: cname.vercel-dns.com.
Loading
Loading