Setup GitHub actions #9
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: {} | |
pull_request_target: | |
types: [opened, reopened, synchronize] | |
jobs: | |
build: | |
name: Preview | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
# SECURITY: We are checking out dnsconfig.js and creds.json from the PR. | |
# These two files cannot perform I/O, and cannot thus be used to leak | |
# the secret tokens. | |
# - name: Checkout config from PR | |
# run: | | |
# git fetch origin +refs/pull/${{ github.event.pull_request.number }}/head | |
# git checkout FETCH_HEAD -- dnsconfig.js | |
- name: Generate preview | |
id: preview | |
run: | | |
{ | |
echo DNS_CONTROL_PREVIEW_OUTPUT<<DNS_CONTROL_PREVIEW_OUTPUT | |
docker run --rm -v "$(pwd):/dns" --env CLOUDFLARE_ACCOUNT_ID --env CLOUDFLARE_API_TOKEN ghcr.io/stackexchange/dnscontrol:4.18.0 preview | |
echo DNS_CONTROL_PREVIEW_OUTPUT | |
} | tee -a $GITHUB_OUTPUT | |
env: | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN_READ_ONLY }} | |
- name: Create comment | |
uses: babel/actions/create-comment@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue: 1 | |
comment: ${{ join(steps.preview.outputs.*, '\n') }} |