Skip to content

Commit b1992cb

Browse files
authored
Merge pull request #1362 from snyk/fix/issue-tagging-script
Fix issue tagging script
2 parents e318395 + 4923cb6 commit b1992cb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

scripts/issue-tagging.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,28 @@ PRs=$(git log --pretty=oneline "$BASE_TAG"..."$LATEST_TAG" | grep 'Merge pull re
3535
# Find fixed issues from $BASE_TAG to $LATEST_TAG
3636
ISSUES=()
3737
for pr in $PRs; do
38-
id=$($GHCLI_BIN pr view "$pr" --json body | grep -oE 'Related issues | #[0-9]+' | sed 's/[^[:digit:]]//g' | sed -z 's/\n//g')
38+
id=$($GHCLI_BIN pr view "$pr" --json body | grep -oE 'Related issues | (.*)?[0-9]+(.*)?\|' | sed 's/[^[:digit:]]//g' | sed -z 's/\n//g' || true)
39+
if [ -z "$id" ]; then
40+
continue
41+
fi
3942
ISSUES+=("$id")
4043
done
4144

42-
echo "Creating milestone $BASE_TAG in github.com/$REPO"
45+
echo "Creating milestone $LATEST_TAG in github.com/$REPO"
4346
curl -X POST \
4447
-H "Accept: application/vnd.github.v3+json" \
4548
-H "Authorization: token $GITHUB_TOKEN" \
46-
--data "{\"title\":\"$BASE_TAG\"}" \
47-
"https://api.github.com/repos/$REPO/milestone"
49+
--data "{\"title\":\"$LATEST_TAG\"}" \
50+
"https://api.github.com/repos/$REPO/milestones"
4851

4952
for issue in "${ISSUES[@]}"; do
50-
if [ -z "$issue" ]; then
51-
continue
52-
fi
53-
echo "Adding milestone $BASE_TAG to issue #$issue"
54-
gh issue edit "$issue" -m "$BASE_TAG"
53+
echo "Adding milestone $LATEST_TAG to issue #$issue"
54+
gh issue edit "$issue" -m "$LATEST_TAG"
5555

5656
curl -X POST \
5757
-H "Accept: application/vnd.github.v3+json" \
5858
-H "Authorization: token $GITHUB_TOKEN" \
59-
--data "{\"body\":\"This issue has been referenced in the latest release $BASE_TAG.\"}" \
59+
--data "{\"body\":\"This issue has been referenced in the latest release $LATEST_TAG.\"}" \
6060
"https://api.github.com/repos/$REPO/issues/$issue/comments"
6161
done
6262

0 commit comments

Comments
 (0)