You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add job name pattern filtering to workflow error script
This commit introduces a new feature to filter jobs by name using a
regular expression in the `print_workflow_run_errors.py` script.
New features:
- Added `--job-pattern` argument, which accepts a regex string.
Only jobs whose names match this pattern will be processed for failures.
- The default value for `--job-pattern` is `'^build.*'`, meaning by
default, the script will only look at jobs starting with 'build'.
Behavior:
- Job name filtering is applied before checking for job failures.
- If an invalid regex is provided for `--job-pattern`, the script prints
an error and exits gracefully.
- This new filter works in conjunction with existing log processing
options (like `--grep-pattern` and `--all-failed-steps`), which are
applied to the jobs that pass the name pattern filter and are failed.
print(f"Workflow run {run['id']} is still in progress. No failed jobs reported yet.")
297
+
print(f"Workflow run {run['id']}({run.get('html_url', 'N/A')}) is still in progress. No jobs matching pattern '{args.job_pattern}' have failed yet.")
269
298
else:
270
-
# This case might indicate the workflow failed but not at a job level,
271
-
# or jobs are still pending/running.
272
-
print(f"Workflow run {run['id']} has conclusion '{run.get('conclusion')}' but no specific failed jobs were identified by this script's criteria.")
299
+
print(f"Workflow run {run['id']} ({run.get('html_url', 'N/A')}) has conclusion '{run.get('conclusion')}', but no jobs matching pattern ('{args.job_pattern}') were found to have failed.")
273
300
sys.exit(0)
274
301
275
-
print(f"\n--- Failed Jobs for Workflow Run ID: {run['id']} ({run.get('html_url', 'No URL')}) ---\n")
302
+
print(f"\n--- Failed Jobs (matching pattern '{args.job_pattern}') for Workflow Run ID: {run['id']} ({run.get('html_url', 'No URL')}) ---\n")
0 commit comments