@@ -20,13 +20,40 @@ function isGfiCandidate(issue) {
2020}
2121
2222module . exports = async ( { github, context } ) => {
23+ console . log ( '[gfi-candidate-guard] Workflow triggered' , {
24+ issue : context . payload . issue ?. number ,
25+ commenter : context . payload . comment ?. user ?. login ,
26+ labels : context . payload . issue ?. labels ?. map ( l => l . name ) ,
27+ body : context . payload . comment ?. body ,
28+ } ) ;
29+
2330 const { issue, comment } = context . payload ;
2431 const { owner, repo } = context . repo ;
2532
26- if ( ! issue || ! comment ) return ;
27- if ( comment . user ?. type === 'Bot' ) return ;
28- if ( ! requestsAssignment ( comment . body ) ) return ;
29- if ( ! isGfiCandidate ( issue ) ) return ;
33+ if ( ! issue || ! comment ) {
34+ console . log ( '[gfi-candidate-guard] Exit: missing issue or comment' ) ;
35+ return ;
36+ }
37+
38+ if ( comment . user ?. type === 'Bot' ) {
39+ console . log ( '[gfi-candidate-guard] Exit: bot comment' ) ;
40+ return ;
41+ }
42+
43+ if ( ! requestsAssignment ( comment . body ) ) {
44+ console . log ( '[gfi-candidate-guard] Exit: no /assign command' ) ;
45+ return ;
46+ }
47+
48+ if ( ! isGfiCandidate ( issue ) ) {
49+ console . log ( '[gfi-candidate-guard] Exit: issue is not GFI candidate' ) ;
50+ return ;
51+ }
52+
53+ console . log ( '[gfi-candidate-guard] GFI candidate assignment attempted' , {
54+ issue : issue . number ,
55+ username : comment . user . login ,
56+ } ) ;
3057
3158 // Prevent duplicate comments
3259 const comments = await github . paginate (
@@ -43,7 +70,17 @@ module.exports = async ({ github, context }) => {
4370 c . body ?. includes ( '<!-- gfi-candidate-not-ready -->' )
4471 ) ;
4572
46- if ( alreadyPosted ) return ;
73+ if ( alreadyPosted ) {
74+ console . log ( '[gfi-candidate-guard] Exit: rejection already posted' , {
75+ issue : issue . number ,
76+ } ) ;
77+ return ;
78+ }
79+
80+ console . log ( '[gfi-candidate-guard] Posting rejection comment' , {
81+ issue : issue . number ,
82+ username : comment . user . login ,
83+ } ) ;
4784
4885 await github . rest . issues . createComment ( {
4986 owner,
0 commit comments