diff --git a/action.yaml b/action.yaml index 7866c0b..d14ab43 100644 --- a/action.yaml +++ b/action.yaml @@ -22,6 +22,9 @@ inputs: issue-body: description: The custom body for the issue required: false + issue-body-file-path: + description: The file path to a custom body for the issue + required: false exclude-workflow-initiator-as-approver: description: Whether or not to filter out the user who initiated the workflow as an approver if they are in the approvers list default: false diff --git a/constants.go b/constants.go index 03e4b4e..e0c8de2 100644 --- a/constants.go +++ b/constants.go @@ -18,6 +18,7 @@ const ( envVarMinimumApprovals string = "INPUT_MINIMUM-APPROVALS" envVarIssueTitle string = "INPUT_ISSUE-TITLE" envVarIssueBody string = "INPUT_ISSUE-BODY" + envVarIssueBodyFilePath string = "INPUT_ISSUE-BODY-FILE-PATH" envVarExcludeWorkflowInitiatorAsApprover string = "INPUT_EXCLUDE-WORKFLOW-INITIATOR-AS-APPROVER" envVarAdditionalApprovedWords string = "INPUT_ADDITIONAL-APPROVED-WORDS" envVarAdditionalDeniedWords string = "INPUT_ADDITIONAL-DENIED-WORDS" diff --git a/main.go b/main.go index 5aad15e..0c66b74 100644 --- a/main.go +++ b/main.go @@ -171,7 +171,17 @@ func main() { } issueTitle := os.Getenv(envVarIssueTitle) - issueBody := os.Getenv(envVarIssueBody) + var issueBody string + if os.Getenv(envVarIssueBodyFilePath) != "" { + fileContents, err := os.ReadFile(os.Getenv(envVarIssueBodyFilePath)) + if err != nil { + fmt.Printf("error reading issue body file: %v\n", err) + os.Exit(1) + } + issueBody = string(fileContents) + } else { + issueBody = os.Getenv(envVarIssueBody) + } minimumApprovalsRaw := os.Getenv(envVarMinimumApprovals) minimumApprovals := 0 if minimumApprovalsRaw != "" {