Skip to content

A fast, helpful, and open-source document parser

add script

Logan Markewich97c7f8740d82
diff --git a/.github/workflows/e2e-output.yml b/.github/workflows/e2e-output.yml
index fda2568..dac9782 100644
--- a/.github/workflows/e2e-output.yml
+++ b/.github/workflows/e2e-output.yml
@@ -47,26 +47,7 @@ jobs:
- name: Compare outputs
id: compare
- run: |
- # Run comparison script
- set +e
- npx tsx scripts/compare-dataset.ts expected-dataset > comparison-output.txt 2>&1
- EXIT_CODE=$?
- set -e
-
- cat comparison-output.txt
-
- if [ $EXIT_CODE -eq 0 ]; then
- echo "has_changes=false" >> $GITHUB_OUTPUT
- echo "✓ No output changes detected"
- elif [ $EXIT_CODE -eq 1 ]; then
- echo "has_changes=true" >> $GITHUB_OUTPUT
- echo "⚠ Output changes detected - requires approval"
- else
- echo "has_changes=error" >> $GITHUB_OUTPUT
- echo "✗ Error running comparison"
- exit 1
- fi
+ run: ./scripts/compare-outputs.sh expected-dataset
- name: Upload comparison results
if: always()
diff --git a/scripts/compare-outputs.sh b/scripts/compare-outputs.sh
new file mode 100755
index 0000000..aa0c649
--- /dev/null
+++ b/scripts/compare-outputs.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# Compare dataset outputs and set GitHub Actions output variables
+# Usage: ./compare-outputs.sh <expected-dataset-path>
+
+set -u
+
+EXPECTED_DATASET="${1:-expected-dataset}"
+OUTPUT_FILE="comparison-output.txt"
+
+# Run comparison script
+set +e
+npx tsx scripts/compare-dataset.ts "$EXPECTED_DATASET" > "$OUTPUT_FILE" 2>&1
+EXIT_CODE=$?
+set -e
+
+cat "$OUTPUT_FILE"
+
+if [ $EXIT_CODE -eq 0 ]; then
+ echo "has_changes=false" >> "$GITHUB_OUTPUT"
+ echo "✓ No output changes detected"
+elif [ $EXIT_CODE -eq 1 ]; then
+ echo "has_changes=true" >> "$GITHUB_OUTPUT"
+ echo "⚠ Output changes detected - requires approval"
+else
+ echo "has_changes=error" >> "$GITHUB_OUTPUT"
+ echo "✗ Error running comparison"
+ exit 1
+fi