File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -43,13 +43,24 @@ jobs:
4343 echo "Checking for existing uses of migrator $migrator in conda-forge..."
4444
4545 # Search in GH-org with exact path where migrators end up
46- query=$(printf "org:conda-forge path:.ci_support/migrations/$migrator" | jq -sRr @uri)
47- response=$(curl -s -H "Accept: application/vnd.github+json" \
48- -H "Authorization: token $GH_TOKEN" \
49- "https://api.github.com/search/code?q=$query")
50- echo "Sent $query"
51- echo "Got $response"
52- num_hits=$(echo "$response" | jq '[.items[] | select(.repository.archived == false)] | length')
46+ query="org:conda-forge path:.ci_support/migrations/$migrator"
47+
48+ # https://api.github.com/search/code?q=... uses the heavily under-powered
49+ # legacy search API; we need the newer API (same as searching in web UI)
50+ # that's only available through graphql apparently
51+ num_hits=$(gh api graphql -f query='
52+ query($queryString: String!) {
53+ search(query: $queryString, type: CODE, first: 10) {
54+ nodes {
55+ ... on Code {
56+ repository { nameWithOwner isArchived }
57+ path
58+ }
59+ }
60+ codeCount
61+ }
62+ }' -f queryString="$queryString" \
63+ --jq '.data.search.nodes | map(select(.repository.isArchived == false)) | length')
5364
5465 if [ "$num_hits" -gt 0 ]; then
5566 echo "Found $num_hits existing occurrences of migrator $migrator in conda-forge"
You can’t perform that action at this time.
0 commit comments