Files
wehub-resource-sync 9201ef759e
CI / lint (push) Waiting to run
CI / mypy (push) Waiting to run
CI / docs (push) Waiting to run
CI / test on 3.10 (standard) (push) Waiting to run
CI / test on 3.11 (standard) (push) Waiting to run
CI / test on 3.12 (standard) (push) Waiting to run
CI / test on 3.10 (all-extras) (push) Waiting to run
CI / test on 3.11 (all-extras) (push) Waiting to run
CI / test on 3.12 (all-extras) (push) Waiting to run
CI / test on 3.13 (all-extras) (push) Waiting to run
CI / test on 3.14 (pydantic-evals) (push) Waiting to run
CI / test on 3.13 (standard) (push) Waiting to run
CI / test on 3.14 (standard) (push) Waiting to run
CI / test on 3.14 (all-extras) (push) Waiting to run
CI / test on 3.10 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.11 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.12 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.13 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.14 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.10 (pydantic-evals) (push) Waiting to run
CI / test on 3.11 (pydantic-evals) (push) Waiting to run
CI / test on 3.12 (pydantic-evals) (push) Waiting to run
CI / test on 3.13 (pydantic-evals) (push) Waiting to run
CI / test on 3.10 (lowest-versions) (push) Waiting to run
CI / test on 3.11 (lowest-versions) (push) Waiting to run
CI / test on 3.12 (lowest-versions) (push) Waiting to run
CI / test on 3.13 (lowest-versions) (push) Waiting to run
CI / test on 3.14 (lowest-versions) (push) Waiting to run
CI / test examples on 3.11 (push) Waiting to run
CI / test examples on 3.12 (push) Waiting to run
CI / test examples on 3.13 (push) Waiting to run
CI / test examples on 3.14 (push) Waiting to run
CI / coverage (push) Blocked by required conditions
CI / check (push) Blocked by required conditions
CI / deploy-docs (push) Blocked by required conditions
CI / deploy-docs-preview (push) Blocked by required conditions
CI / build release artifacts (push) Blocked by required conditions
CI / publish to PyPI (push) Blocked by required conditions
CI / Send tweet (push) Blocked by required conditions
Harness Compat / harness compat (push) Failing after 0s
chore: import upstream snapshot with attribution
2026-07-13 13:27:52 +08:00

65 lines
2.3 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
repo="${GITHUB_REPOSITORY:?GITHUB_REPOSITORY is required}"
out_root="/tmp/gh-aw/agent"
issues_root="${out_root}/issues"
all_dir="${issues_root}/all"
batches_dir="${issues_root}/batches"
index_file="${out_root}/open-issues.tsv"
manifest_file="${issues_root}/batch-manifest.tsv"
raw_file="${issues_root}/open-issues.raw.json"
batch_size="${BATCH_SIZE:-25}"
issue_limit="${ISSUE_LIMIT:-1000}"
rm -rf "${issues_root}"
mkdir -p "${all_dir}" "${batches_dir}"
printf "number\ttitle\tupdated_at\tcreated_at\tlabel_names\n" > "${index_file}"
printf "batch\tissue_number\tupdated_at\tlabel_names\n" > "${manifest_file}"
# Fetch all open issues sorted by oldest update time first.
gh issue list \
--repo "${repo}" \
--state open \
--limit "${issue_limit}" \
--search "sort:updated-asc" \
--json number,title,body,updatedAt,createdAt,url,labels,author,assignees \
> "${raw_file}"
issue_count="$(jq 'length' "${raw_file}")"
if [[ "${issue_count}" == "0" ]]; then
echo "No open issues found."
exit 0
fi
count=0
while IFS= read -r issue_json; do
count=$((count + 1))
number="$(jq -r '.number' <<< "${issue_json}")"
updated_at="$(jq -r '.updatedAt' <<< "${issue_json}")"
created_at="$(jq -r '.createdAt' <<< "${issue_json}")"
title="$(jq -r '.title' <<< "${issue_json}" | tr '\t\n' ' ' | sed 's/ */ /g')"
labels="$(jq -r '[.labels[].name] | join(",")' <<< "${issue_json}")"
printf '%s\n' "${issue_json}" > "${all_dir}/${number}.json"
printf "%s\t%s\t%s\t%s\t%s\n" "${number}" "${title}" "${updated_at}" "${created_at}" "${labels}" >> "${index_file}"
batch_index=$(((count - 1) / batch_size + 1))
batch_name="$(printf 'batch-%03d' "${batch_index}")"
batch_path="${batches_dir}/${batch_name}"
mkdir -p "${batch_path}"
cp "${all_dir}/${number}.json" "${batch_path}/${number}.json"
printf "%s\t%s\t%s\t%s\n" "${batch_name}" "${number}" "${updated_at}" "${labels}" >> "${manifest_file}"
done < <(jq -c '.[]' "${raw_file}")
batch_count="$(find "${batches_dir}" -mindepth 1 -maxdepth 1 -type d | wc -l | tr -d ' ')"
echo "Prescanned ${count} open issues into ${all_dir}"
echo "Created ${batch_count} batch folder(s) in ${batches_dir} (batch size: ${batch_size})"
echo "Index file: ${index_file}"
echo "Batch manifest: ${manifest_file}"