Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Github comments from tfnotify #120

Open
leszczynskimikolaj opened this issue Oct 31, 2022 · 7 comments
Open

No Github comments from tfnotify #120

leszczynskimikolaj opened this issue Oct 31, 2022 · 7 comments

Comments

@leszczynskimikolaj
Copy link

My issue:
Even though I set GITHUB_REF env var, I still get tfnotify comments attached to my commits instead of having them attached to related PR and what's more I do not get any labels attached to my PR.

My tfnotify.yml

ci: github-actions
notifier:
  github:
    token: <redacted>
    repository:
      owner: <redacted>
      name: <redacted>
terraform:
  plan:
    template: |
      {{ .Title }}
      {{ .Message }}
      {{if .Result}}
      <pre><code>{{ .Result }}
      </pre></code>
      {{end}}
      <details><summary>Details (Click me)</summary>
      <pre><code>{{ .Body }}
      </pre></code></details>
    when_add_or_update_only:
      label: "add-or-update"
    when_no_changes:
      label: "no-changes"
    when_plan_error:
      label: "error"
    when_destroy:
      label: "destroy"
      template: |
        ## :warning: WARNING: Resource Deletion will happen :warning:
        This plan contains **resource deletion**. Please check the plan result very carefully!

The command I run as part of my local tests:

export GITHUB_REF=refs/pull/240/merge
cat plan_result.temp | tfnotify --config tfnotify.yml plan --message "example tfnotify comment message"

I have a feeling tfnotify does not respect the GITHUB_REF env var I set and hence this code does not get executed.

@Starefossen
Copy link
Contributor

I am facing similar problems and tfnotify is not setting any lanes either...

@leszczynskimikolaj
Copy link
Author

cc: @dtan4 as I saw this PR

@Starefossen
Copy link
Contributor

I got this to work locally but for some reason tfnotify insists on posting commit comments instead of pull request comments for the exact same environment variables set.

@leszczynskimikolaj
Copy link
Author

@Starefossen what do you mean exactly? I also get the commit's comments instead of pull request's comments but still no PR labels. Can you provide here the command you run?

@Starefossen
Copy link
Contributor

I compiled it myself, didn't realize that the "latest" version was so far behind master branch.

@Starefossen
Copy link
Contributor

You can use the tfnotify binary I have compiled from here: https://github.com/nais/tfnotify/releases/tag/v0.7.8

@Starefossen
Copy link
Contributor

I also made #121 to fix the build and release so they can get a new version out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants