Skip to content

Commit 9033f86

Browse files
committed
Add GitHub Actions workflow for DNS plan
1 parent a8576bc commit 9033f86

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/dns.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
on:
2+
pull_request:
3+
jobs:
4+
octodns-sync:
5+
name: Run `octodns-sync` with production.yaml
6+
runs-on: ubuntu-20.04
7+
defaults:
8+
run:
9+
working-directory: ./dns
10+
outputs:
11+
plan: ${{ steps.generate-plan.outputs.plan }}
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-python@v2
15+
with:
16+
python-version: '3.12'
17+
- run: pip install -r requirements.txt
18+
- uses: solvaholic/octodns-sync@main
19+
id: generate-plan
20+
with:
21+
config_path: dns/production.yaml
22+
env:
23+
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
24+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
25+
add-pr-comment:
26+
name: Add `octodns-sync` plan to comment
27+
needs: [octodns-sync]
28+
runs-on: ubuntu-20.04
29+
steps:
30+
- name: Find previous comment, if present
31+
uses: peter-evans/find-comment@v1.2.0
32+
id: fc
33+
with:
34+
issue-number: ${{ github.event.pull_request.number }}
35+
comment-author: github-actions[bot]
36+
body-includes: Automatically generated by octodns-sync
37+
- name: Create or update comment
38+
id: prcomment
39+
uses: peter-evans/create-or-update-comment@v1.4.5
40+
with:
41+
issue-number: ${{ github.event.pull_request.number }}
42+
comment-id: ${{ steps.fc.outputs.comment-id }}
43+
body: |
44+
## OctoDNS Plan for `${{ github.ref }}`
45+
46+
${{ needs.octodns-sync.outputs.plan }}
47+
edit-mode: replace

0 commit comments

Comments
 (0)