Skip to content

Commit a61f0d4

Browse files
committed
fix workflow
1 parent 04849b2 commit a61f0d4

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

.github/actions/db-inserts-verify/action.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ inputs:
1414
default: 'false'
1515
parse_regex:
1616
description: RegEx to capture ROWS_INSERTED=NNN (advanced override)
17-
required: false
17+
required: ''
1818
default: 'ROWS_INSERTED\s*=\s*([0-9]+)'
1919

2020
runs:
@@ -27,7 +27,17 @@ runs:
2727
set -euo pipefail
2828
echo "[verify] running: ${{ inputs.run }}"
2929
bash -lc '${{ inputs.run }}' 2>&1 | tee report.out
30-
count="$(grep -Eo "${{ inputs.parse_regex }}" report.out | sed -E 's/.*=([0-9]+).*/\1/' | tail -n1 || true)"
30+
31+
32+
# Pick regex
33+
regex="${{ inputs.parse_regex }}"
34+
if [[ -z "$regex" ]]; then
35+
# Default: match common formats
36+
regex='([0-9]+)[[:space:]]*(rows inserted|total inserted|committed|Inserted|ROWS_INSERTED=)'
37+
fi
38+
39+
# Find last match
40+
count="$(grep -Eo "${{ inputs.parse_regex }}" report.out | sed -E 's/.*=([0-9]+).*/\1/' | tail -n1 || true)"
3141
if [[ -z "${count:-}" ]]; then count=0; fi
3242
echo "rows_inserted=${count}" >> "$GITHUB_OUTPUT"
3343

.github/workflows/demo-db-insert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414

1515
jobs:
1616
deploy:
17-
name: Testops Check All Jobs on Push
17+
name: Demo - Verify DB insert / delete
1818
runs-on: ubuntu-latest
1919

2020
steps:

0 commit comments

Comments
 (0)