diff options
author | 2024-04-27 18:31:35 +0100 | |
---|---|---|
committer | 2024-04-27 19:27:24 +0100 | |
commit | f018a2c5ed121832deba992f750161af42886c9d (patch) | |
tree | b7a32ba4f8320c01c5e701207a1522f9d7ace8bc | |
parent | Add zone files for all our domains (diff) |
Add GitHub Actions workflow for DNS plan
-rw-r--r-- | .github/workflows/dns-dry-run.yaml | 49 | ||||
-rw-r--r-- | dns/production.yaml | 2 |
2 files changed, 50 insertions, 1 deletions
diff --git a/.github/workflows/dns-dry-run.yaml b/.github/workflows/dns-dry-run.yaml new file mode 100644 index 0000000..f74d154 --- /dev/null +++ b/.github/workflows/dns-dry-run.yaml @@ -0,0 +1,49 @@ +name: Generate DNS change plan + +on: + pull_request: +jobs: + octodns-sync: + name: Run `octodns-sync` with production.yaml + runs-on: ubuntu-20.04 + defaults: + run: + working-directory: ./dns + outputs: + plan: ${{ steps.generate-plan.outputs.plan }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.12' + - run: pip install -r requirements.txt + - uses: solvaholic/octodns-sync@main + id: generate-plan + with: + config_path: dns/production.yaml + env: + CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + add-pr-comment: + name: Add `octodns-sync` plan to comment + needs: [octodns-sync] + runs-on: ubuntu-20.04 + steps: + - name: Find previous comment, if present + uses: peter-evans/[email protected] + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: github-actions[bot] + body-includes: "OctoDNS Plan for " + - name: Create or update comment + id: prcomment + uses: peter-evans/[email protected] + with: + issue-number: ${{ github.event.pull_request.number }} + comment-id: ${{ steps.fc.outputs.comment-id }} + body: | + # OctoDNS Plan for `${{ github.event.pull_request.head.ref }}` + + ${{ needs.octodns-sync.outputs.plan }} + edit-mode: replace diff --git a/dns/production.yaml b/dns/production.yaml index bce3d0f..775e1a7 100644 --- a/dns/production.yaml +++ b/dns/production.yaml @@ -7,7 +7,7 @@ manager: providers: zone_config: class: octodns.provider.yaml.YamlProvider - directory: zones + directory: dns/zones default_ttl: 300 enforce_order: true cloudflare: |