Skip to content

Commit a1f6995

Browse files
committed
fix: use process substitution for counter persistence in batch processor
1 parent 698c3e4 commit a1f6995

1 file changed

Lines changed: 9 additions & 17 deletions

File tree

.github/workflows/auditor-batch-processor.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,14 @@ jobs:
4949
echo "--- Phase 1: Promote completed audits to contribution ---"
5050
PROMOTED=0
5151
52-
gh issue list --label "audit-complete" --state open --json number,title,labels \
53-
--jq '.[] | select(.labels | map(.name) | (contains(["security-blocked"]) | not) and (contains(["contribute-approved"]) | not) and (contains(["prs-submitted"]) | not)) | "\(.number)\t\(.title)"' \
54-
2>/dev/null | while IFS=$'\t' read -r ISSUE_NUM TITLE; do
55-
56-
# Extract repo name from issue title
52+
# Use process substitution to avoid subshell counter issue
53+
while IFS=$'\t' read -r ISSUE_NUM TITLE; do
5754
REPO=$(echo "$TITLE" | sed 's/Audit candidate: //')
58-
SLUG="${REPO//\//-}"
59-
60-
# Check registry for security status
6155
SECURITY=$(jq -r --arg name "$REPO" '.repos[$name].security // "UNKNOWN"' auditor/registry/repos.json)
6256
6357
if [ "$SECURITY" = "BLOCKED" ]; then
6458
echo " SKIP #$ISSUE_NUM ($REPO): security BLOCKED"
65-
continue
66-
fi
67-
68-
if [ "$SECURITY" = "CLEAR" ] || [ "$SECURITY" = "REVIEW" ]; then
59+
elif [ "$SECURITY" = "CLEAR" ] || [ "$SECURITY" = "REVIEW" ]; then
6960
echo " PROMOTE #$ISSUE_NUM ($REPO): security=$SECURITY → contribute-approved"
7061
if [ "$DRY_RUN" != "true" ]; then
7162
gh issue edit "$ISSUE_NUM" --add-label "contribute-approved" 2>/dev/null || true
@@ -74,7 +65,9 @@ jobs:
7465
else
7566
echo " SKIP #$ISSUE_NUM ($REPO): security=$SECURITY (unknown/not audited)"
7667
fi
77-
done
68+
done < <(gh issue list --label "audit-complete" --state open --json number,title,labels \
69+
--jq '.[] | select(.labels | map(.name) | (contains(["security-blocked"]) | not) and (contains(["contribute-approved"]) | not) and (contains(["prs-submitted"]) | not)) | "\(.number)\t\(.title)"' \
70+
2>/dev/null)
7871
7972
echo "Promoted: $PROMOTED issues to contribute-approved"
8073
echo ""
@@ -98,9 +91,7 @@ jobs:
9891
9992
# Get candidates sorted by issue number (oldest first = FIFO)
10093
PICKED=0
101-
gh issue list --label "audit-candidate" --state open --json number,title \
102-
--jq 'sort_by(.number) | .[].number' 2>/dev/null | while read -r ISSUE_NUM; do
103-
94+
while read -r ISSUE_NUM; do
10495
[ "$PICKED" -ge "$AVAILABLE" ] && break
10596
10697
TITLE=$(gh issue view "$ISSUE_NUM" --json title --jq '.title' 2>/dev/null)
@@ -121,7 +112,8 @@ jobs:
121112
gh issue edit "$ISSUE_NUM" --add-label "audit-ready" --remove-label "audit-candidate" 2>/dev/null || true
122113
fi
123114
PICKED=$((PICKED + 1))
124-
done
115+
done < <(gh issue list --label "audit-candidate" --state open --json number,title \
116+
--jq 'sort_by(.number) | .[].number' 2>/dev/null)
125117
126118
echo "Picked: $PICKED repos for audit"
127119
echo ""

0 commit comments

Comments
 (0)