Skip to content

Commit

Permalink
adding the two variables in more methods and approvalEnvironment struct
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny-1651 committed Oct 21, 2024
1 parent 4f354ed commit b543d9b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion approval.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ type approvalEnvironment struct {
issueBody string
issueApprovers []string
minimumApprovals int
targetRepo string
targetRepoOwner string
}

func newApprovalEnvironment(client *github.Client, repoFullName, repoOwner string, runID int, approvers []string, minimumApprovals int, issueTitle, issueBody string) (*approvalEnvironment, error) {
func newApprovalEnvironment(client *github.Client, repoFullName, repoOwner string, runID int, approvers []string, minimumApprovals int, issueTitle, issueBody string, targetRepo string, targetRepoOwner string) (*approvalEnvironment, error) {
repoOwnerAndName := strings.Split(repoFullName, "/")
if len(repoOwnerAndName) != 2 {
return nil, fmt.Errorf("repo owner and name in unexpected format: %s", repoFullName)
Expand All @@ -40,6 +42,8 @@ func newApprovalEnvironment(client *github.Client, repoFullName, repoOwner strin
minimumApprovals: minimumApprovals,
issueTitle: issueTitle,
issueBody: issueBody,
targetRepoOwner: targetRepoOwner,
targetRepo: targetRepo,
}, nil
}

Expand Down
2 changes: 2 additions & 0 deletions constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const (
envVarExcludeWorkflowInitiatorAsApprover string = "INPUT_EXCLUDE-WORKFLOW-INITIATOR-AS-APPROVER"
envVarAdditionalApprovedWords string = "INPUT_ADDITIONAL-APPROVED-WORDS"
envVarAdditionalDeniedWords string = "INPUT_ADDITIONAL-DENIED-WORDS"
envVarTargetRepo string = "INPUT_TARGET-REPO"
envVarTargetRepoOwner string = "INPUT_TARGET-REPO-OWNER"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func main() {

repoowner := os.Getenv("repo-owner")
reponame := os.Getenv("repo-name")
fmt.Println("repo owner: %s, name: %s", repoowner, reponame)
fmt.Printf("repo owner: %s, name: %s \n", repoowner, reponame)

repoFullName := os.Getenv(envVarRepoFullName)
runID, err := strconv.Atoi(os.Getenv(envVarRunID))
Expand Down

0 comments on commit b543d9b

Please sign in to comment.