From e882f1fe19de36a3edb468939e09dceb98895193 Mon Sep 17 00:00:00 2001 From: Philip Frerk Date: Tue, 17 Dec 2024 07:29:31 +0100 Subject: [PATCH 1/4] chore: check for non-labeled issues (#32707) Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> --- .../find-issues-with-missing-labels.yml | 22 ++++++ docs/development/issue-labeling.md | 12 ++++ tools/find-issues-with-missing-labels.sh | 68 +++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 .github/workflows/find-issues-with-missing-labels.yml create mode 100755 tools/find-issues-with-missing-labels.sh diff --git a/.github/workflows/find-issues-with-missing-labels.yml b/.github/workflows/find-issues-with-missing-labels.yml new file mode 100644 index 00000000000000..631c98b67b88f6 --- /dev/null +++ b/.github/workflows/find-issues-with-missing-labels.yml @@ -0,0 +1,22 @@ +name: 'Find issues with missing labels' + +on: + schedule: + # Run every Sunday at midnight + - cron: '0 0 * * 0' + +jobs: + check-unlabeled-issues: + runs-on: ubuntu-latest + + permissions: + issues: write + + env: + GH_TOKEN: ${{ github.token }} + + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Search for issues with missing labels + run: bash ./tools/find-issues-with-missing-labels.sh diff --git a/docs/development/issue-labeling.md b/docs/development/issue-labeling.md index e294b2745eddf0..35038eab39c8f3 100644 --- a/docs/development/issue-labeling.md +++ b/docs/development/issue-labeling.md @@ -221,3 +221,15 @@ Add a label `auto:retry-latest` to any Discussion where the user should retry th Apply the `self-hosted` label when an issue is applicable only to users who self-administer their own bot. + +## Automated check for Issues with missing labels + +We have a GitHub Action (`find-issues-with-missing-labels.yml`) to find issues on our repository that are missing labels. +Any Issues with missing labels will be put in a list in a new "error" Issue. + +The Action runs each week. + +### Apply the correct labels manually + +The Action will _not_ fix any badly labeled issues. +This means that you, or we, must apply the correct labels to any affected Issue. diff --git a/tools/find-issues-with-missing-labels.sh b/tools/find-issues-with-missing-labels.sh new file mode 100755 index 00000000000000..26bdc15eadc7ed --- /dev/null +++ b/tools/find-issues-with-missing-labels.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +# When the repository labels are changed (i.e dropped a label, added a label, etc), you should make the same change to the lists below. +# For example, if the repository added a "type:task" type label, then add "-label:type:task" to the TYPE_LABELS_FILTER. +TYPE_LABELS_FILTER='-label:type:bug -label:type:feature -label:type:docs -label:type:refactor -label:type:help' + +PRIORITY_LABELS_FILTER='-label:priority-1-critical -label:priority-2-high -label:priority-3-medium -label:priority-4-low' + +HAS_ISSUES_MISSING_LABELS=false + +ISSUE_BODY="# Label check action\n" + +REPO='renovatebot/renovate' + +ISSUE_TITLE="Issues with missing labels" + +for FILTER in "$TYPE_LABELS_FILTER" "$PRIORITY_LABELS_FILTER"; do + # Extract the label type from the filter + LABEL_TYPE=$(echo "$FILTER" | cut -d ':' -f 2 | cut -d '-' -f 1) + + # Fetch issues that match the filter + ISSUES_MISSING_LABEL=$(gh issue list --repo $REPO --limit 100000 -s open -S "$FILTER" --json "number,title") || { echo "Failed to fetch issues without $LABEL_TYPE labels"; exit 1; } + # Ignore the Issue from the "Find issues with missing labels" Action + ISSUES_MISSING_LABEL=$(echo "$ISSUES_MISSING_LABEL" | jq --arg title "$ISSUE_TITLE" 'map(select(.title != $title))') + + if [ "$ISSUES_MISSING_LABEL" != "[]" ]; then + HAS_ISSUES_MISSING_LABELS=true + + # Create a list of issue numbers + FORMATTED_OUTPUT=$(echo "$ISSUES_MISSING_LABEL" | jq -r '.[].number' | sed 's/^/- #/') + + # Count the issues and decide if the output should be singular or plural + ISSUE_COUNT=$(echo "$ISSUES_MISSING_LABEL" | jq '. | length') + ISSUE_SINGULAR_PLURAL=$(if [ "$ISSUE_COUNT" -eq 1 ]; then echo "issue"; else echo "issues"; fi) + + # Append the "list of issues without labels" to the issue body + ISSUE_BODY="$ISSUE_BODY## Found $ISSUE_COUNT $ISSUE_SINGULAR_PLURAL missing \`$LABEL_TYPE:\` labels:\n$FORMATTED_OUTPUT\n" + fi +done + +if [ "$HAS_ISSUES_MISSING_LABELS" = false ]; then + echo "All checked issues have labels. Exiting the action." + exit 0 +fi + +LABEL_CHECK_ISSUE_EXISTS=$(gh search issues --repo $REPO --json "number,author,title" | jq --arg title "$ISSUE_TITLE" 'map(select(.title == $title and .author.type == "Bot"))') || { echo "Failed to fetch existing label check issue"; exit 1; } +ISSUE_NUMBER=$(echo "$LABEL_CHECK_ISSUE_EXISTS" | jq -r '.[].number') + +if [ -z "$ISSUE_NUMBER" ]; then + + # Create a new issue (with the list of issues in it). + gh issue create --repo $REPO --title "$ISSUE_TITLE" --body "$(echo -e "$ISSUE_BODY")" || { echo "Failed to create issue."; exit 1; } +else + # Edit the open issue, and update the list of issues. + gh issue edit "$ISSUE_NUMBER" --repo $REPO --title "$ISSUE_TITLE" --body "$(echo -e "$ISSUE_BODY")" || { echo "Failed to update issue."; exit 1; } + + # Re-open the issue. + gh issue reopen "$ISSUE_NUMBER" --repo $REPO || { echo "Failed to reopen issue"; exit 1; } +fi + +# Show the list of "issues with missing labels" in the logs. +echo -e "$ISSUE_BODY" + +# Log a message and "fail" the Action if there are issues with missing labels +echo "Found issues without labels. Please check the issue(s) listed above. Exiting the action." + +exit 1 + From f0775a6afa35f886efa0a4aaa04ce8bb3fdc764a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 09:35:41 +0100 Subject: [PATCH 2/4] chore(deps): update actions/checkout action to v4.2.2 (#33158) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/find-issues-with-missing-labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/find-issues-with-missing-labels.yml b/.github/workflows/find-issues-with-missing-labels.yml index 631c98b67b88f6..f0e41b7ae98585 100644 --- a/.github/workflows/find-issues-with-missing-labels.yml +++ b/.github/workflows/find-issues-with-missing-labels.yml @@ -16,7 +16,7 @@ jobs: GH_TOKEN: ${{ github.token }} steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Search for issues with missing labels run: bash ./tools/find-issues-with-missing-labels.sh From 9ad2e599a610b64ca52047830259406337bd0ee8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 08:40:49 +0000 Subject: [PATCH 3/4] build(deps): update dependency zod to v3.24.0 (#33159) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 5bb8ac73cabc86..0065e9fa281153 100644 --- a/package.json +++ b/package.json @@ -251,7 +251,7 @@ "vuln-vects": "1.1.0", "xmldoc": "1.3.0", "yaml": "2.6.1", - "zod": "3.23.8" + "zod": "3.24.0" }, "optionalDependencies": { "better-sqlite3": "11.7.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9fe0d0aab24512..a94a735ddbae2e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -336,8 +336,8 @@ importers: specifier: 2.6.1 version: 2.6.1 zod: - specifier: 3.23.8 - version: 3.23.8 + specifier: 3.24.0 + version: 3.24.0 optionalDependencies: better-sqlite3: specifier: 11.7.0 @@ -6304,8 +6304,8 @@ packages: resolution: {integrity: sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==} engines: {node: '>=18'} - zod@3.23.8: - resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} + zod@3.24.0: + resolution: {integrity: sha512-Hz+wiY8yD0VLA2k/+nsg2Abez674dDGTai33SwNvMPuf9uIrBC9eFgIMQxBBbHFxVXi8W+5nX9DcAh9YNSQm/w==} zwitch@1.0.5: resolution: {integrity: sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==} @@ -8024,7 +8024,7 @@ snapshots: fs-extra: 11.2.0 toml-eslint-parser: 0.10.0 upath: 2.0.1 - zod: 3.23.8 + zod: 3.24.0 '@renovatebot/eslint-plugin@file:tools/eslint': {} @@ -13533,6 +13533,6 @@ snapshots: yoctocolors@2.1.1: {} - zod@3.23.8: {} + zod@3.24.0: {} zwitch@1.0.5: {} From af6a80edcc5f917422164fb9d4ff104fd0fbce07 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 09:43:55 +0100 Subject: [PATCH 4/4] build(deps): update emojibase monorepo to v16 (major) (#33160) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 6 +++--- pnpm-lock.yaml | 33 +++++++++++++++++---------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 0065e9fa281153..16ef1ebb049034 100644 --- a/package.json +++ b/package.json @@ -192,8 +192,8 @@ "editorconfig": "2.0.0", "email-addresses": "5.0.0", "emoji-regex": "10.4.0", - "emojibase": "15.3.1", - "emojibase-regex": "15.3.2", + "emojibase": "16.0.0", + "emojibase-regex": "16.0.0", "extract-zip": "2.0.1", "find-packages": "10.0.4", "find-up": "5.0.0", @@ -317,7 +317,7 @@ "callsite": "1.0.0", "common-tags": "1.8.2", "conventional-changelog-conventionalcommits": "8.0.0", - "emojibase-data": "15.3.2", + "emojibase-data": "16.0.2", "eslint": "8.57.1", "eslint-formatter-gha": "1.5.1", "eslint-import-resolver-typescript": "3.6.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a94a735ddbae2e..8c898459be2752 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -159,11 +159,11 @@ importers: specifier: 10.4.0 version: 10.4.0 emojibase: - specifier: 15.3.1 - version: 15.3.1 + specifier: 16.0.0 + version: 16.0.0 emojibase-regex: - specifier: 15.3.2 - version: 15.3.2 + specifier: 16.0.0 + version: 16.0.0 extract-zip: specifier: 2.0.1 version: 2.0.1 @@ -524,8 +524,8 @@ importers: specifier: 8.0.0 version: 8.0.0 emojibase-data: - specifier: 15.3.2 - version: 15.3.2(emojibase@15.3.1) + specifier: 16.0.2 + version: 16.0.2(emojibase@16.0.0) eslint: specifier: 8.57.1 version: 8.57.1 @@ -3090,16 +3090,17 @@ packages: emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} - emojibase-data@15.3.2: - resolution: {integrity: sha512-TpDyTDDTdqWIJixV5sTA6OQ0P0JfIIeK2tFRR3q56G9LK65ylAZ7z3KyBXokpvTTJ+mLUXQXbLNyVkjvnTLE+A==} + emojibase-data@16.0.2: + resolution: {integrity: sha512-vRM82rvhjB4z5jDvxYanK/CZVe1QCu9ihxockyNvitd/aFkTT6Y4eeBW49GoXv5JMCNFrzDarADWrv7tjLcefA==} peerDependencies: emojibase: '*' - emojibase-regex@15.3.2: - resolution: {integrity: sha512-ue6BVeb2qu33l97MkxcOoyMJlg6Tug3eTv2z1at+M9TjvlWKvdmAPvZIDG1JbT2RH3FSyJNLucO5K5H/yxT03w==} + emojibase-regex@16.0.0: + resolution: {integrity: sha512-ZMp31BkzBWNW+T73of6NURL6nXQa5GkfKneOkr3cEwBDVllbW/2nuva7NO0J3RjaQ07+SZQNgPTGZ4JlIhmM2Q==} - emojibase@15.3.1: - resolution: {integrity: sha512-GNsjHnG2J3Ktg684Fs/vZR/6XpOSkZPMAv85EHrr6br2RN2cJNwdS4am/3YSK3y+/gOv2kmoK3GGdahXdMxg2g==} + emojibase@16.0.0: + resolution: {integrity: sha512-Nw2m7JLIO4Ou2X/yZPRNscHQXVbbr6SErjkJ7EooG7MbR3yDZszCv9KTizsXFc7yZl0n3WF+qUKIC/Lw6H9xaQ==} + engines: {node: '>=18.12.0'} emojilib@2.4.0: resolution: {integrity: sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw==} @@ -9839,13 +9840,13 @@ snapshots: emoji-regex@9.2.2: {} - emojibase-data@15.3.2(emojibase@15.3.1): + emojibase-data@16.0.2(emojibase@16.0.0): dependencies: - emojibase: 15.3.1 + emojibase: 16.0.0 - emojibase-regex@15.3.2: {} + emojibase-regex@16.0.0: {} - emojibase@15.3.1: {} + emojibase@16.0.0: {} emojilib@2.4.0: {}