Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 40 additions & 12 deletions .github/workflows/pipeline-orchestrator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,25 +115,53 @@ jobs:
exit 0
fi

# Find oldest aw-labeled issue without aw-dispatched, agentic-workflows, or aw-protected-files
ISSUE=$(gh api graphql -f query='
query($owner: String!, $repo: String!) {
repository(owner: $owner, name: $repo) {
issues(labels: ["aw"], states: OPEN, first: 20, orderBy: {field: CREATED_AT, direction: ASC}) {
nodes {
number
title
labels(first: 100) { nodes { name } }
# Find oldest aw-labeled issue without aw-dispatched, agentic-workflows, aw-protected-files, or backlog
CURSOR=""
ISSUE="null"
while true; do
if [[ -n "$CURSOR" ]]; then
CURSOR_ARG=", after: \"$CURSOR\""
else
CURSOR_ARG=""
fi

RESULT=$(gh api graphql -f query="
query(\$owner: String!, \$repo: String!) {
repository(owner: \$owner, name: \$repo) {
issues(labels: [\"aw\"], states: OPEN, first: 100, orderBy: {field: CREATED_AT, direction: ASC}${CURSOR_ARG}) {
nodes {
number
title
labels(first: 100) { nodes { name } }
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
}' -f owner="$OWNER" -f repo="$REPO" \
--jq '[.data.repository.issues.nodes[] | select(
}" -f owner="$OWNER" -f repo="$REPO")

ISSUE=$(echo "$RESULT" | jq '[.data.repository.issues.nodes[] | select(
([.labels.nodes[].name] | any(. == "aw-dispatched") | not)
and ([.labels.nodes[].name] | any(. == "agentic-workflows") | not)
and ([.labels.nodes[].name] | any(. == "aw-protected-files") | not)
and ([.labels.nodes[].name] | any(. == "backlog") | not)
)] | .[0]')

# Found an eligible issue — stop paginating
if [[ "$ISSUE" != "null" && -n "$ISSUE" ]]; then
break
fi

# Check if there are more pages
HAS_NEXT=$(echo "$RESULT" | jq -r '.data.repository.issues.pageInfo.hasNextPage')
if [[ "$HAS_NEXT" != "true" ]]; then
break
fi
CURSOR=$(echo "$RESULT" | jq -r '.data.repository.issues.pageInfo.endCursor')
done

if [[ "$ISSUE" == "null" || -z "$ISSUE" ]]; then
echo "No eligible issues to dispatch. Pipeline idle."
exit 0
Expand Down
Loading