MCPcopy Create free account
hub / github.com/dflook/terraform-github-actions / TerraformComment

Class TerraformComment

image/src/github_pr_comment/comment.py:22–125  ·  view source on GitHub ↗

Represents a Terraform PR comment The comment must have been successfully created for an object of this type to have been created. A Terraform PR comment has a number of elements that are formatted such that they can later be parsed back into an equivalent TerraformComment object.

Source from the content-addressed store, hash-verified

20 version = '0.0.0'
21
22class TerraformComment:
23 """
24 Represents a Terraform PR comment
25
26 The comment must have been successfully created for an object of this type to have been created.
27
28 A Terraform PR comment has a number of elements that are formatted such that they can later be parsed back into
29 an equivalent TerraformComment object.
30
31 header_fields = [
32 'workspace', # The terraform workspace
33 'backend', # A fingerprint of the backend config
34 'label', # The label input
35 'backend_type', # The backend type name
36 'plan_modifier', # Hash of plan modifiers (target/replace options)
37 'plan_job_ref', # A text reference to the actions job that generated the plan
38 'plan_hash', # A deterministic hash of the plan (without warnings or unchanged attributes, eventually with unmasked variables)
39 'variables_hash', # A hash of input variables and values
40 'truncated' # If the plan text has been truncated (should not be used to approve plans, and will not show a complete diff)
41 'closed' # If the comment has been closed for modifications
42 ]
43
44 """
45
46 def __init__(self, *, issue_url: IssueUrl, comment_url: Optional[CommentUrl], node_id: Optional[NodeId], headers: dict[str, str], description: str, summary: str, body: str, status: str, body_highlighting: str = ''):
47 self._issue_url = issue_url
48 self._comment_url = comment_url
49 self._node_id = node_id
50 self._headers = headers
51 self._description = description.strip()
52 self._summary = summary.strip()
53 self._body = body.strip()
54 self._body_highlighting = body_highlighting
55 self._status = status.strip()
56
57 def __eq__(self, other):
58 if not isinstance(other, TerraformComment):
59 return NotImplemented
60
61 return (
62 self._issue_url == other._issue_url and
63 self._comment_url == other._comment_url and
64 self._node_id == other._node_id and
65 self._headers == other._headers and
66 self._description == other._description and
67 self._summary == other._summary and
68 self._body == other._body and
69 self._body_highlighting == other._body_highlighting and
70 self._status == other._status
71 )
72
73 def __ne__(self, other):
74 return not self.__eq__(other)
75
76 def __repr__(self):
77 return f'TerraformComment(issue_url={self._issue_url!r}, comment_url={self._comment_url!r}, node_id={self.node_id}, headers={self._headers!r}, description={self._description!r}, summary={self._summary!r}, body={self._body!r}, status={self._status!r}, body_highlighting={self._body_highlighting!r})'
78
79 @property

Callers 15

new_pr_commentFunction · 0.90
test_no_headersFunction · 0.90
test_headersFunction · 0.90
test_bad_descriptionFunction · 0.90
test_bad_bodyFunction · 0.90
test_path_onlyFunction · 0.90
test_varFunction · 0.90
test_var_fileFunction · 0.90
test_backend_configFunction · 0.90

Calls

no outgoing calls

Tested by 15

test_no_headersFunction · 0.72
test_headersFunction · 0.72
test_bad_descriptionFunction · 0.72
test_bad_bodyFunction · 0.72
test_path_onlyFunction · 0.72
test_varFunction · 0.72
test_var_fileFunction · 0.72
test_backend_configFunction · 0.72