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

Unhandled error with jq: error (at <stdin>:4): Cannot index string with string "body" #36

Open
evertonspader-tomtom opened this issue Apr 30, 2024 · 6 comments

Comments

@evertonspader-tomtom
Copy link

It seems there is an issue with an unhandled error:

INFO: Found no tfplan file. Using input argument.
INFO: Found 1 page(s) of comments at https://api.github.com/repos/<org>/<repo>/issues/236/comments?per_page=100.
INFO: Looking for an existing plan PR comment.
jq: error (at <stdin>:4): Cannot index string with string "body"
INFO: No existing plan PR comment found.

This is what I am using:

- name: "Generate PR comment from Terraform Plan"
  id: terraform-plan-pr
  uses: GetTerminus/terraform-pr-commenter@v3
  with:
    commenter_type: plan
    commenter_input: ${{ format('{0}{1}', steps.terraform-plan.outputs.stdout, steps.terraform-plan.outputs.stderr) }}
    commenter_exitcode: ${{ steps.terraform-plan.outputs.exitcode }}

From the releases I see that there has not been much activity in this repository but I hope this issue can be addressed

@piotr-tokaj
Copy link

piotr-tokaj commented Jun 10, 2024

I have the same issue, with exactly the following error:

INFO: Found no tfplan file. Using input argument.
INFO: Found 1 page(s) of comments at https://api.github.com/repos/<org>/<repo>/issues/18/comments?per_page=100.
INFO: Looking for an existing plan PR comment.
jq: error (at <stdin>:5): Cannot index string with string "body"
INFO: No existing plan PR comment found.
INFO: Found 1 page(s) of comments at https://api.github.com/repos/<org>/<repo>/issues/18/comments?per_page=100.
INFO: Looking for an existing outputs PR comment.
jq: error (at <stdin>:5): Cannot index string with string "body"
INFO: No existing outputs PR comment found.
INFO: Writing 1 plan comment(s)
INFO: Adding plan comment to PR.
INFO: Writing 0 outputs comment(s)

@CpuID
Copy link

CpuID commented Jun 13, 2024

Getting the same here

@CpuID
Copy link

CpuID commented Jun 13, 2024

Fairly sure it's something to do with this line (matches the line number and its calling jq): https://github.com/GetTerminus/terraform-pr-commenter/blob/master/utilities/comment_utility.sh#L5

@CpuID
Copy link

CpuID commented Jun 13, 2024

I think I solved this - was permissions related potentially on my secrets.GITHUB_TOKEN token.

@piotr-tokaj
Copy link

piotr-tokaj commented Jun 14, 2024

I think I solved this - was permissions related potentially on my secrets.GITHUB_TOKEN token.

@CpuID What exactly did you change?

@piotr-tokaj
Copy link

Ok you're right, I needed to make sure I have

permissions:
  pull-requests: 'write'

It seems to be granted by default, but I was overriding the permissions in the workflow for another reason, and this step was missing the ability to read or write PR comments

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

3 participants