Skip to content

Infracost summary not added to PR comment #98

@BFarand

Description

@BFarand

Describe the Bug

When pr-comment is set to true and Infracost is enabled (in atmos configuration and infracost-api-key is provided), the %INFRACOST_SUMMARY% and %INFRACOST_DIFF% placeholders are not replaced in the comment made in the pull request.

Note that the Infracost summary is added successfully to the GitHub action summary, so the results can still be viewed there. It is only missing from the PR comment.

From what I can tell, the PR comment is made as part of the tfcmt commands. The job step that replaces the Infracost placeholders, Set Infracost Variables, runs after the tfcmt commands, so the Infracost variables are not available in time for tfcmt. This is a bit of an interesting problem as tfcmt is also responsible for running the plan, which is required by Infracost.

Expected Behavior

The PR comment should match nearly/exactly 1:1 with the GitHub action summary. The %INFRACOST_SUMMARY% and %INFRACOST_DIFF% placeholders should be properly replaced.

Steps to Reproduce

  1. Ensure integrations.github.gitops.infracost-enabled is set to true in atmos configuration.
  2. In the workflow, ensure infracost-api-key is provided and pr-comment is set to true.
  3. Run the workflow (preferably with an expected change).
  4. Observe the PR comment result.

Screenshots

No response

Environment

  • Version 4.3.0 of this action (digest 1694fc56284f79173c36922f869933c6cb1d8b72)

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🐛 An issue with the system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions