diff --git a/.github/workflows/enforce-labelling.yml b/.github/workflows/enforce-labelling.yml index 6254af247..6d315e6db 100644 --- a/.github/workflows/enforce-labelling.yml +++ b/.github/workflows/enforce-labelling.yml @@ -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