Error: Cannot read properties of undefined (reading 'head')
I am attempting to use the action but I'm getting the following error:
Run borchero/terraform-plan-comment@v2
with:
token: ***
working-directory: src
planfile: plan.tfplan
terraform-cmd: terraform
header: 📝 Terraform Plan
Render plan
Render comment
Error: Cannot read properties of undefined (reading 'head')
There is no expanded out under the render plan, or render comment steps (not sure if there should be).
Running ls -la src outputs:
drwxr-xr-x 3 runner docker 4096 Sep 23 10:53 .
drwxr-xr-x 6 runner docker 4096 Sep 23 10:53 ..
drwxr-xr-x 3 runner docker 4096 Sep 23 10:53 .terraform
-rw-r--r-- 1 runner docker 2710 Sep 23 10:53 .terraform.lock.hcl
-rw-r--r-- 1 runner docker 98 Sep 23 10:53 main.tf
-rw-r--r-- 1 runner docker 5337 Sep 23 10:53 plan.tfplan
Any ideas what could be causing this?
Is the workflow called from a pull_request event? I think this would cause the error (which should probably be improved...).
I have an open PR, and I am pushing commits to it. So I have:
on:
push:
in my workflow
I see! Your workflow requires the trigger
on:
pull_request:
as, otherwise, the action does not know which PR to post a comment to. In a push event, the context only provides the branch name and not the pull request(s) that the branch is associated with.
Now do we skip posting when we have a workflow with both:
on:
push:
branches:
- main
pull_request:
branches:
- main
Now do we skip posting when we have a workflow with both:
Yes, exactly. You'd need to add if: github.event_name == 'pull_request' to the workflow step which uploads the comment.
🤖 Stalebot
This issue hasn't seen updates in the last 60 days.
If it has been resolved or won't be worked on, please consider closing the issue. Otherwise, it will be closed automatically in 30 days.