fix: scan all post-mortems for TODOs (no git diff needed)
This commit is contained in:
parent
f336e5ed53
commit
c742fa3dfb
1 changed files with 11 additions and 22 deletions
|
|
@ -3,31 +3,20 @@
|
||||||
# Called from .woodpecker/postmortem-todos.yml
|
# Called from .woodpecker/postmortem-todos.yml
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# 1. Find which post-mortem changed
|
# 1. Find post-mortem(s) with TODO items
|
||||||
# Woodpecker shallow clones (depth 1) so HEAD~1 may not exist. Fetch more history.
|
# Scan all post-mortems — don't rely on git diff (Woodpecker shallow clone breaks HEAD~1)
|
||||||
git fetch --deepen=2 origin master 2>/dev/null || true
|
PM_FILE=""
|
||||||
PM_FILE=$(git diff HEAD~1 --name-only 2>/dev/null | grep 'docs/post-mortems/.*[.]md' | head -1)
|
for f in docs/post-mortems/*.md; do
|
||||||
|
if grep -q '| TODO |' "$f" 2>/dev/null; then
|
||||||
|
PM_FILE="$f"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
if [ -z "$PM_FILE" ]; then
|
if [ -z "$PM_FILE" ]; then
|
||||||
# Fallback: check all post-mortems for TODO items
|
echo "No post-mortem with pending TODOs found"
|
||||||
for f in docs/post-mortems/*.md; do
|
|
||||||
if grep -q '| TODO |' "$f" 2>/dev/null; then
|
|
||||||
PM_FILE="$f"
|
|
||||||
echo "Fallback: found TODOs in $f"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
if [ -z "$PM_FILE" ]; then
|
|
||||||
echo "No post-mortem with TODOs found"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
echo "Post-mortem: $PM_FILE"
|
|
||||||
|
|
||||||
# 2. Check if there are TODO items to process
|
|
||||||
if ! grep -q '| TODO |' "$PM_FILE"; then
|
|
||||||
echo "No TODOs in $PM_FILE — skipping"
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
echo "Post-mortem with TODOs: $PM_FILE"
|
||||||
|
|
||||||
# 3. Parse TODOs
|
# 3. Parse TODOs
|
||||||
bash scripts/parse-postmortem-todos.sh "$PM_FILE" > /tmp/todos.json
|
bash scripts/parse-postmortem-todos.sh "$PM_FILE" > /tmp/todos.json
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue