Skip to content

Commit

Permalink
fixed delete command
Browse files Browse the repository at this point in the history
  • Loading branch information
maZahaca committed May 22, 2020
1 parent 630b29d commit 54d90c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
12 changes: 5 additions & 7 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Delete DNS Record"
name: "CloudFlare Delete DNS Record"
description: "Deletes CloudFlare DNS record"
author: "Kriasoft"
author: "InfraWay"

inputs:
id:
Expand All @@ -9,11 +9,9 @@ inputs:
description: "DNS record name"
token:
description: "CloudFlare API token"
default: ${{ secrets.CLOUDFLARE_TOKEN }}
required: true
zone:
default: "CloudFlare zone"
default: ${{ secrets.CLOUDFLARE_ZONE }}
description: "CloudFlare zone"
required: true

outputs:
Expand All @@ -23,5 +21,5 @@ runs:
main: "main.js"

branding:
icon: "at-sign"
color: "orange"
icon: "globe"
color: "green"
8 changes: 1 addition & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

const cp = require("child_process");

const event = require(process.env.GITHUB_EVENT_PATH);
const pr = event.pull_request ? event.pull_request.number : "?";

let res;
let result;
let id = process.env.INPUT_ID;
Expand All @@ -30,10 +27,7 @@ if (!id) {
process.exit(1);
}

const name = (process.env.INPUT_NAME || "")
.replace(/\{pr\}/gi, pr)
.replace(/\{pr_number\}/gi, pr)
.replace(/\{head_ref\}/gi, process.env.GITHUB_HEAD_REF);
const name = process.env.INPUT_NAME;
const record = res.result.find((x) => x.name === name);

if (!record) {
Expand Down

0 comments on commit 54d90c4

Please sign in to comment.