Add option for using a file as input for the issue body (#140)
* Add option for using a file as input for the issue body * Revert irrelevant version bumps
This commit is contained in:
parent
3441ed44b6
commit
dd3e4e00d2
3 changed files with 15 additions and 1 deletions
|
|
@ -19,6 +19,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
|
||||
required: false
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
12
main.go
12
main.go
|
|
@ -199,7 +199,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 != "" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue