Skip to content

Commit 0e77fe3

Browse files
committed
fix: allow extract workflow to continue on per-file failures
1 parent c12ac98 commit 0e77fe3

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

.github/workflows/extract-sir.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ jobs:
3636
run: |
3737
python3 extract_sir_pdf_gemini.py pdfs \
3838
--output-dir analysis_output \
39-
--max-new-files ${{ github.event.inputs.max_new_files }}
39+
--max-new-files ${{ github.event.inputs.max_new_files }} \
40+
--allow-file-failures
4041
env:
4142
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
4243

extract_sir_pdf_gemini.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,12 @@ def main() -> int:
657657
action="store_false",
658658
help="Do not skip annual report PDFs.",
659659
)
660+
parser.add_argument(
661+
"--allow-file-failures",
662+
action="store_true",
663+
default=False,
664+
help="Exit with code 0 even if some PDFs fail; failed files are still reported.",
665+
)
660666
args = parser.parse_args()
661667

662668
if args.max_new_files < 0:
@@ -879,7 +885,15 @@ def main() -> int:
879885
print(f"[SUMMARY ALL] {csv_path}")
880886
print(f"[SUMMARY ALL] {json_path}")
881887

882-
return 1 if failures else 0
888+
if failures:
889+
if args.allow_file_failures:
890+
print(
891+
f"[WARN] Completed with {failures} failed file(s); exiting 0 because --allow-file-failures is set.",
892+
file=sys.stderr,
893+
)
894+
return 0
895+
return 1
896+
return 0
883897

884898

885899
if __name__ == "__main__":

0 commit comments

Comments
 (0)