mercari / tfnotify

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

`tfnotify` support custom environment variable #111

Closed KeisukeYamashita closed 2 years ago

KeisukeYamashita commented 2 years ago

WHAT

Curretly, to read the GitHub Token from the environment variable, the $GITHUB_TOKEN is supported. It lookups the env var named GITHUB_TOKEN for the tokens.

https://github.com/mercari/tfnotify/blob/fb178d8a5a51f88a51b7fda93ed5443ff56dfc8f/notifier/github/client.go#L73-L75

But it would be nice if the tfnotify can support custom variables as below:

ci: circleci
notifier:
  github:
    token: $MY_CUSTOM_GITHUB_TOKEN  <-- not working, only $GITHUB_TOKEN is supported
    repository:
      owner: "mercari"
....

Note that this will not break existing users. The users that configure $GITHUB_TOKEN can still use the GITHUB_TOKEN env var on their runtime.