Skip to content

Commit 02da616

Browse files
committed
Create an issue per library
1 parent 0337846 commit 02da616

File tree

1 file changed

+35
-12
lines changed

1 file changed

+35
-12
lines changed

.github/workflows/check-new-library-versions-in-batch.yml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,19 +147,42 @@ jobs:
147147
- name: "✏️ Issue for unsupported versions"
148148
run: |
149149
if [ -d "unsupported" ]; then
150+
151+
cd unsupported
150152
git config --local user.email "[email protected]"
151-
git config --local user.name "Github Actions"
153+
git config --local user.name "Github Actions"
154+
155+
# Map from <group_artifact> to list of versions
156+
declare -A failures
157+
158+
for FILENAME in *; do
159+
GROUPID=$(echo "$FILENAME" | cut -d'_' -f1)
160+
ARTIFACTID=$(echo "$FILENAME" | cut -d'_' -f2)
161+
VERSION=$(echo "$FILENAME" | cut -d'_' -f3)
162+
GA="${GROUPID}:${ARTIFACTID}"
163+
failures["$GA"]+="${VERSION}"$'\n'
164+
done
165+
166+
for GA in "${!failures[@]}"; do
167+
TITLE="Failure for $GA"
168+
EXISTING_ISSUE_URL=$(gh issue list --state "open" --search "$TITLE" --json title,url | jq -r ".[] | select(.title==\"$TITLE\") | .url")
169+
170+
BODY="${failures[$GA]}"
171+
172+
if [ -n "$EXISTING_ISSUE_URL" ]; then
173+
# issue exists, just append new failures
174+
EXISTING_BODY=$(gh issue view "$EXISTING_ISSUE_URL" --json body -q .body)
152175
153-
LABEL="library-update"
154-
ALL_LIBRARIES=$(ls unsupported)
155-
FORMATTED_BODY=$(./gradlew -q groupLibrariesByName --libraries="$ALL_LIBRARIES")
176+
for VERSION in ${failures[$GA]}; do
177+
if ! grep -q "$VERSION" <<< "$EXISTING_BODY"; then
178+
EXISTING_BODY="${EXISTING_BODY}"$'\n'"$VERSION"
179+
fi
180+
done
156181
157-
EXISTING_ISSUE=$(gh issue list --label "$LABEL" --state open --limit 1 --json url | jq -r '.[0].url')
158-
if [ $EXISTING_ISSUE != "null" ]; then
159-
gh issue edit $EXISTING_ISSUE --body "$FORMATTED_BODY"
160-
else
161-
gh issue create --title "List unsupported libraries versions" --body "$FORMATTED_BODY" --label $LABEL
162-
fi
163-
else
164-
echo "There are no failing versions"
182+
gh issue edit "$EXISTING_ISSUE_URL" --body "$EXISTING_BODY"
183+
else
184+
# Create new issue with all versions
185+
gh issue create --title "$TITLE" --body "$BODY" --label library-update
186+
fi
187+
done
165188
fi

0 commit comments

Comments
 (0)