Skip to content

Commit af64247

Browse files
authored
Merge branch 'main' into update-scorecard-workflow
2 parents 9106006 + 738727d commit af64247

2 files changed

Lines changed: 14 additions & 34 deletions

File tree

dev_tools/ci/size-labeler.sh

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ PR_NUMBER, GITHUB_REPOSITORY, GITHUB_TOKEN. The script is intended
2424
for automated execution from GitHub Actions workflow."
2525

2626
declare -ar LABELS=(
27-
"Size: XS"
27+
"size: XS"
2828
"size: S"
2929
"size: M"
3030
"size: L"
@@ -39,14 +39,6 @@ declare -A LIMITS=(
3939
["${LABELS[4]}"]="$((2 ** 63 - 1))"
4040
)
4141

42-
declare -ar IGNORED=(
43-
"*_pb2.py"
44-
"*_pb2.pyi"
45-
"*_pb2_grpc.py"
46-
".*.lock"
47-
"*.bundle.js"
48-
)
49-
5042
function info() {
5143
echo >&2 "INFO: ${*}"
5244
}
@@ -110,30 +102,20 @@ function api_call() {
110102

111103
function compute_changes() {
112104
local -r pr="$1"
105+
local page=1
106+
local changes=0
107+
while true; do
108+
local response
109+
response="$(api_call "pulls/${pr}/files?per_page=100&page=${page}")"
110+
111+
if [[ "$(jq_stdin 'length' <<<"${response}")" -eq 0 ]]; then
112+
break
113+
fi
113114

114-
local response
115-
local change_info
116-
local -r keys_filter='with_entries(select([.key] | inside(["changes", "filename"])))'
117-
response="$(api_call "pulls/${pr}/files")"
118-
change_info="$(jq_stdin "map(${keys_filter})" <<<"${response}")"
119-
120-
local files total_changes
121-
readarray -t files < <(jq_stdin -c '.[]' <<<"${change_info}")
122-
total_changes=0
123-
for file in "${files[@]}"; do
124-
local name changes
125-
name="$(jq_stdin -r '.filename' <<<"${file}")"
126-
for pattern in "${IGNORED[@]}"; do
127-
if [[ "$name" =~ ${pattern} ]]; then
128-
info "File $name ignored"
129-
continue 2
130-
fi
131-
done
132-
changes="$(jq_stdin -r '.changes' <<<"${file}")"
133-
info "File $name +-$changes"
134-
total_changes="$((total_changes + changes))"
115+
changes=$((changes + $(jq_stdin '[0, .[].changes] | add' <<<"${response}")))
116+
((page++))
135117
done
136-
echo "$total_changes"
118+
echo "${changes}"
137119
}
138120

139121
function get_size_label() {

docs/_index.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ description: >
1919
landing_page:
2020
custom_css_path: /site-assets/css/style.css
2121
rows:
22-
- classname: quantum-hero quantum-hero--qsim quantum-hero--icon-medium
22+
- classname: quantum-hero quantum-hero--qsim
2323
options:
2424
- hero
2525
- description-50
2626
- padding-large
2727
heading: qsim
28-
icon:
29-
path: /site-assets/images/icons/icon_qsim.png
3028
description: >
3129
Optimized quantum circuit simulators
3230
items:

0 commit comments

Comments
 (0)