mercari / tfnotify

A CLI command to parse Terraform execution result and notify it to GitHub
MIT License
619 stars 91 forks source link

Support to configure a label color #86

Closed suzuki-shunsuke closed 2 years ago

suzuki-shunsuke commented 3 years ago

WHAT

Support to configure a label color.

WHY

It is useful and important to configure a label color properly. We can know what is changed by color. It is bothersome to configure label colors manually. Especially, this feature is useful for Monorepo.

We use tfnotify at Monorepo and the number of Terraform states are over 60. So the number of labels are 60 * 4 = 240. It is bothersome to configure the label color manually.

HOW

Add optional color fields to the configuration file.

    when_add_or_update_only:
      label: "add-or-update"
      label_color: "1d76db" # blue
    when_destroy:
      label: "destroy"
      label_color: "d93f0b" # red
      template: |
        ## :warning: WARNING: Resource Deletion will happen :warning:
        This plan contains **resource deletion**. Please check the plan result very carefully!
    when_no_changes:
      label: "no-changes"
      label_color: "0e8a16" # green
    when_plan_error:
      label: "staging/error"

Add labels to an issue API returns labels. If the color of returned label is different from the configuration, update the color by Update a label API.

suzuki-shunsuke commented 3 years ago

I have sent a pull request to solve this issue. https://github.com/mercari/tfnotify/pull/87

suzuki-shunsuke commented 3 years ago

label_color is better than color. https://github.com/mercari/tfnotify/pull/87/commits/385cfda9c96ad6fa39627ff71414555a54be88c1