Skip to content

Commit

Permalink
fix: diff indicator matching terms (#235)
Browse files Browse the repository at this point in the history
* remove deprovision steps for simplicity

* fix diff indicator matching

* account for "has been" change type

* format js
  • Loading branch information
RDhar committed Jun 25, 2024
1 parent 5e5ab4a commit fee64a8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/comment_tf_output.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ ${process.env.tf_fmt}
// Re-prefix the lines with diff indicators based on the change type.
const changed_lines = tfplan
.split("\n")
.filter(line => line.startsWith(" # "))
.map(line => {
.filter((line) => line.startsWith(" # "))
.map((line) => {
const diff_line = line.slice(4);
if (diff_line.includes("create")) return "+ " + diff_line;
if (diff_line.includes("update")) return "! " + diff_line;
if (diff_line.includes("delete")) return "- " + diff_line;
if (diff_line.includes(" created")) return "+ " + diff_line;
if (diff_line.includes(" destroyed")) return "- " + diff_line;
if (diff_line.includes(" updated")) return "! " + diff_line;
if (diff_line.includes(" been")) return "# " + diff_line;
return diff_line;
});

Expand Down

0 comments on commit fee64a8

Please sign in to comment.