Skip to content

Commit

Permalink
Try to detect unlinked issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jhiemstrawisc committed Nov 27, 2024
1 parent adcb1db commit 465750f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/enforce-labelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,17 @@ jobs:
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/issues/$PR_NUMBER/timeline")
echo "Timeline JSON: $TIMELINE_JSON"
# LINKED_ISSUES=$(echo "$TIMELINE_JSON" | jq '[.[] | select(.event == "cross-referenced") | .source.issue.number] | length')
LINKED_ISSUES=$(echo "$TIMELINE_JSON" | jq '[.[] | select(.event == "cross-referenced" or .event == "connected") | .source.issue.number] | length')
LINKED_ISSUES=$(echo "$TIMELINE_JSON" | jq '
reduce .[] as $event (
{};
if $event.event == "cross-referenced" or $event.event == "connected" then
.[$event.source.issue.number] = true
elif $event.event == "unlinked" then
del(.[$event.source.issue.number])
else
.
end
) | keys | length')
if [ "$LINKED_ISSUES" -eq "0" ]; then
echo "No linked issues found in the pull request."
exit 1
Expand Down

0 comments on commit 465750f

Please sign in to comment.