Skip to content

Commit

Permalink
chore: use action instead of curl
Browse files Browse the repository at this point in the history
  • Loading branch information
Orkuncakilkaya committed Oct 31, 2023
1 parent 779954a commit 4a5daa8
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,17 @@ on:
- '!main'

jobs:
create-cloudflare-dns-record:
ci:
runs-on: ubuntu-20.04
steps:
- name: Extract Branch Name
id: extract-branch
run: |
echo BRANCH_NAME=$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | perl -pe 's/\W/-/g and s/-+$//g') >> $GITHUB_OUTPUT
- name: Create Cloudflare DNS Record
run: |
curl --location --request POST 'https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE_ID }}/dns_records' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Email: ${{ secrets.CF_AUTH_EMAIL }}' \
--header 'Authorization: Bearer ${{ secrets.CF_AUTH_TOKEN }}' \
--data-raw '{
"content": "${{steps.extract-branch.outputs.BRANCH_NAME}}.cfi-fingerprint.com.edgesuite.net",
"name": "${{steps.extract-branch.outputs.BRANCH_NAME}}.cfi-fingerprint.com",
"proxied": false,
"type": "CNAME",
"comment": "Akamai CI run for ${{steps.extract-branch.outputs.BRANCH_NAME}}",
"tags": [
"owner:akamai"
],
"ttl": 3600
}'
uses: fjogeleit/http-request-action@v1
with:
url: 'https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE_ID }}/dns_records'
method: 'POST'
customHeaders: '{"X-Auth-Email": "${{ secrets.CF_AUTH_EMAIL }}", "Authorization": "Bearer ${{ secrets.CF_AUTH_TOKEN }}"}'
data: '{"content": "${{steps.extract-branch.outputs.BRANCH_NAME}}.cfi-fingerprint.com.edgesuite.net", "name": "${{steps.extract-branch.outputs.BRANCH_NAME}}.cfi-fingerprint.com", "proxied": false, "type": "CNAME", "comment": "Akamai CI run for ${{steps.extract-branch.outputs.BRANCH_NAME}}", "ttl": 3600, "tags": ["owner:akamai-integration-ci"]}'

0 comments on commit 4a5daa8

Please sign in to comment.