Skip to content

Commit f15c36b

Browse files
committed
add additional validation
1 parent 70f6598 commit f15c36b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

backend/ci_backends/github_actions.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package ci_backends
33
import (
44
"context"
55
"encoding/json"
6+
"fmt"
67
"github.com/diggerhq/digger/backend/utils"
78
orchestrator_scheduler "github.com/diggerhq/digger/libs/scheduler"
89
"github.com/diggerhq/digger/libs/spec"
@@ -33,6 +34,11 @@ func (g GithubActionCi) TriggerWorkflow(spec spec.Spec, runName string, vcsToken
3334
}
3435

3536
func (g GithubActionCi) GetWorkflowUrl(spec spec.Spec) (string, error) {
37+
if spec.JobId == "" {
38+
log.Printf("Cannot get workflow URL: JobId is empty")
39+
return "", fmt.Errorf("job ID is required to fetch workflow URL")
40+
}
41+
3642
_, workflowRunUrl, err := utils.GetWorkflowIdAndUrlFromDiggerJobId(g.Client, spec.VCS.RepoOwner, spec.VCS.RepoName, spec.JobId)
3743
if err != nil {
3844
log.Printf("Error getting workflow ID from job: %v", err)

0 commit comments

Comments
 (0)