@@ -61,7 +61,7 @@ func (e *Executor) Run(ctx context.Context, point HookPoint, input HookContext)
6161 }
6262 for _ , spec := range specs {
6363 hookInput := input .Clone ()
64- if spec .Scope == HookScopeUser {
64+ if spec .Scope == HookScopeUser || spec . Scope == HookScopeRepo {
6565 hookInput = sanitizeUserHookContext (hookInput )
6666 }
6767 result := e .runOne (ctx , spec , hookInput )
@@ -70,11 +70,13 @@ func (e *Executor) Run(ctx context.Context, point HookPoint, input HookContext)
7070 if result .Status == HookResultBlock {
7171 output .Blocked = true
7272 output .BlockedBy = spec .ID
73+ output .BlockedSource = spec .Source
7374 break
7475 }
7576 if result .Status == HookResultFailed && spec .FailurePolicy == FailurePolicyFailClosed {
7677 output .Blocked = true
7778 output .BlockedBy = spec .ID
79+ output .BlockedSource = spec .Source
7880 break
7981 }
8082 }
@@ -88,6 +90,7 @@ func (e *Executor) runOne(ctx context.Context, spec HookSpec, input HookContext)
8890 HookID : spec .ID ,
8991 Point : spec .Point ,
9092 Scope : spec .Scope ,
93+ Source : spec .Source ,
9194 Kind : spec .Kind ,
9295 Mode : spec .Mode ,
9396 StartedAt : startedAt ,
@@ -107,6 +110,9 @@ func (e *Executor) runOne(ctx context.Context, spec HookSpec, input HookContext)
107110 if result .Scope == "" {
108111 result .Scope = spec .Scope
109112 }
113+ if result .Source == "" {
114+ result .Source = spec .Source
115+ }
110116 if result .DurationMS <= 0 {
111117 result .DurationMS = durationMS
112118 }
@@ -118,6 +124,7 @@ func (e *Executor) runOne(ctx context.Context, spec HookSpec, input HookContext)
118124 HookID : spec .ID ,
119125 Point : spec .Point ,
120126 Scope : spec .Scope ,
127+ Source : spec .Source ,
121128 Kind : spec .Kind ,
122129 Mode : spec .Mode ,
123130 Status : result .Status ,
@@ -131,6 +138,7 @@ func (e *Executor) runOne(ctx context.Context, spec HookSpec, input HookContext)
131138 HookID : spec .ID ,
132139 Point : spec .Point ,
133140 Scope : spec .Scope ,
141+ Source : spec .Source ,
134142 Kind : spec .Kind ,
135143 Mode : spec .Mode ,
136144 Status : result .Status ,
@@ -166,6 +174,7 @@ func (e *Executor) callHandler(
166174 HookID : spec .ID ,
167175 Point : spec .Point ,
168176 Scope : spec .Scope ,
177+ Source : spec .Source ,
169178 Status : HookResultFailed ,
170179 Message : err ,
171180 Error : err ,
@@ -201,6 +210,7 @@ func (e *Executor) callHandler(
201210 HookID : spec .ID ,
202211 Point : spec .Point ,
203212 Scope : spec .Scope ,
213+ Source : spec .Source ,
204214 Status : HookResultFailed ,
205215 Message : err ,
206216 Error : err ,
@@ -213,6 +223,7 @@ func (e *Executor) callHandler(
213223 HookID : spec .ID ,
214224 Point : spec .Point ,
215225 Scope : spec .Scope ,
226+ Source : spec .Source ,
216227 Status : HookResultFailed ,
217228 Message : err ,
218229 Error : err ,
@@ -222,6 +233,7 @@ func (e *Executor) callHandler(
222233 outcome .result .HookID = spec .ID
223234 outcome .result .Point = spec .Point
224235 outcome .result .Scope = spec .Scope
236+ outcome .result .Source = spec .Source
225237 if outcome .result .Status == "" {
226238 outcome .result .Status = HookResultPass
227239 }
@@ -233,6 +245,7 @@ func (e *Executor) callHandler(
233245 HookID : spec .ID ,
234246 Point : spec .Point ,
235247 Scope : spec .Scope ,
248+ Source : spec .Source ,
236249 Status : HookResultFailed ,
237250 Message : err ,
238251 Error : err ,
0 commit comments