actions icon indicating copy to clipboard operation
actions copied to clipboard

Error: body-file ./terraform/comment.md does not exist

Open DonggeunYu opened this issue 3 years ago • 4 comments

I used the following yaml. But I get an error not finding the comment.md file.

  pluralith:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    env:
      working-directory: ./terraform
    steps:
      - name: Check out repository
        uses: actions/checkout@v3
        with:
          ref: ${{ github.event.pull_request.head.ref }}

      # Set up Terraform
      - name: Setup Terraform
        uses: hashicorp/setup-terraform@v1
        with:
          terraform_wrapper: false # This is recommended so the `terraform show` command outputs valid JSON
        env:
          GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS_DEV }}

      # Init Terraform project
      - name: Terraform Init
        run: terraform init
        working-directory: ${{ env.working-directory }}
        env:
          GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS_DEV }}

      - name: Setup Infracost
        uses: infracost/actions/setup@v2
        # See https://github.com/infracost/actions/tree/master/setup for other inputs
        # If you can't use this action, see Docker images in https://infracost.io/cicd
        with:
          api-key: ${{ secrets.INFRACOST_API_KEY }}

      # Set up and authenticate Pluralith
      - name: Pluralith Init
        uses: Pluralith/actions/[email protected]
        with:
          terraform-path: ${{ env.working-directory }}
          api-key: ${{ secrets.PLURALITH_API_KEY }}
          project-id: ${{ secrets.PLURALITH_PROJECT_ID }}
        env:
          GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS_DEV }}

      # Run Pluralith to generate an infrastructure diagram and comment body
      - name: Pluralith Run
        uses: Pluralith/actions/[email protected]
        with:
          title: \#${{ github.event.number }}
          terraform-command: "plan"
          terraform-path: ${{ env.working-directory }}
          show-changes: true
          show-drift: true
          show-costs: true # Requires Infracost to be set up in your pipeline
        env:
          GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS_DEV }}

      # Post the generated diagram as a GitHub comment
      - name: Pluralith Comment
        uses: Pluralith/actions/[email protected]
        with:
          terraform-path: ${{ env.working-directory }}
          behavior: hide-and-new
        env:
          GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS_DEV }}

Error:

Error: Error: body-file ./terraform/comment.md does not exist

DonggeunYu avatar Dec 25 '22 16:12 DonggeunYu

I have the same problem with a similar configuration... we hope you help us with this problem. @DanThePutzer

DilanAriza avatar Feb 09 '23 21:02 DilanAriza

@DilanAriza thanks for reporting!

We've seen this issue before, usually it happens because the step before the comment step fails, but is marked as successful anyway.

Could you check in your action what the output for the step before the failing one says? It could say something like "No org ID given" or something like that. Let me know if that is the case and I can help fix it!

DanThePutzer avatar Feb 10 '23 07:02 DanThePutzer