@@ -70,14 +70,27 @@ def get_report()
70
70
end
71
71
end
72
72
73
+ def get_workflows ( client , repo_name )
74
+ workflow_page = 0
75
+ workflows = [ ]
76
+ loop do
77
+ workflow_page += 1
78
+ cur_page_workflows = client . workflows ( repo_name , :page => workflow_page ) . workflows
79
+ if cur_page_workflows . length == 0
80
+ break
81
+ end
82
+ workflows . push ( *cur_page_workflows )
83
+ end
84
+ return workflows
85
+ end
86
+
73
87
failure_report = Table . new ( ISSUE_TITLE )
74
88
success_report = Table . new ( ISSUE_TITLE )
75
89
client = Octokit ::Client . new ( access_token : ENV [ "INPUT_ACCESS-TOKEN" ] )
76
90
last_issue = client . list_issues ( REPO_NAME_WITH_OWNER , :labels => ISSUE_LABELS , :state => "all" ) [ 0 ]
77
- workflows = client . workflows ( REPO_NAME_WITH_OWNER )
78
91
79
92
puts "Excluded workflow files: " + EXCLUDED_WORKFLOWS . join ( "," )
80
- for wf in workflows . workflows do
93
+ for wf in get_workflows ( client , REPO_NAME_WITH_OWNER ) do
81
94
# skip if it is the issue generation workflow.
82
95
if wf . name == ENV [ "GITHUB_WORKFLOW" ]
83
96
next
@@ -120,7 +133,7 @@ def get_report()
120
133
# If the last issue is open, then failed report will be commented to the issue.
121
134
elsif !last_issue . nil? and last_issue . state == "open"
122
135
client . add_comment ( REPO_NAME_WITH_OWNER , last_issue . number , failure_report . get_report )
123
- # Creat an new issue otherwise .
136
+ # Create a new issue if there exists failed workflows .
124
137
else
125
- client . create_issue ( REPO_NAME_WITH_OWNER , ISSUE_TITLE , failure_report . get_report , labels : ISSUE_LABELS , assignee : ASSIGNEE )
138
+ client . create_issue ( REPO_NAME_WITH_OWNER , ISSUE_TITLE , failure_report . get_report , labels : ISSUE_LABELS , assignee : ASSIGNEE ) unless ! failure_report . get_report . nil?
126
139
end
0 commit comments