Skip to content

Commit

Permalink
Merge branch 'main' into devbox-versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
burritobill authored Dec 17, 2024
2 parents a4b7b95 + f0775a6 commit 4e02f02
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 15 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/find-issues-with-missing-labels.yml
Original file line number Diff line number Diff line change
@@ -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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Search for issues with missing labels
run: bash ./tools/find-issues-with-missing-labels.sh
12 changes: 12 additions & 0 deletions docs/development/issue-labeling.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,15 @@ Add a label `auto:retry-latest` to any Discussion where the user should retry th
</details>

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.
24 changes: 18 additions & 6 deletions docs/usage/config-overview.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
# Renovate configuration overview

When Renovate runs on a repository, the final config used is derived from the:
Each time Renovate runs on a repository it reads the configuration files listed below and creates a final config.
This final config describes what Renovate will do during its run.

- Default config
- Global config
- Inherited config
- Repository config
- Resolved presets referenced in config
The final config is internal to Renovate, and is _not_ saved or cached for a later run.
But you can always find the final config in Renovate's logs.

Renovate reads the configuration files in this order (from from top to bottom):

1. Default config
2. Global config
- File config
- Environment config
- CLI config
3. Inherited config
4. Resolved presets referenced in config
5. Repository config

Items with a higher number override items that have lower numbers.
If the item has the `mergeable` property, it will merge with lower numbers instead.

<!-- prettier-ignore -->
!!! note
Expand Down
10 changes: 5 additions & 5 deletions docs/usage/upgrade-best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Pinning your development dependencies means you, and your team, are using the sa
This makes the developer-tool side of your builds reproducible.
Debugging faulty versions of your tools is easier, because you can use Git to check out different versions of the tools.

### Why updating often is easier, faster and safer
## Why updating often is easier, faster and safer

You may think that updating takes too much time.
But updating regularly actually _saves_ you time, because:
Expand All @@ -98,14 +98,14 @@ But updating regularly actually _saves_ you time, because:
- You'll be ready for CVE patches
- You'll look for ways to automate the updates

#### Regular updates tend to be small
### Regular updates tend to be small

Firstly, when you update regularly updates tend to be small.
The update's changelogs are small, quick to read, and easy to understand.
You probably only need to make changes in a few places (if at all) to merge the PR and get going again.
Because you're reading the changelogs regularly, you'll get a feel for the direction of the upstream project.

#### Applying `major` updates is easier
### Applying `major` updates is easier

Secondly, when you're current with upstream, `major` updates are easier.
This is because you already:
Expand All @@ -114,14 +114,14 @@ This is because you already:
- use the latest names for features/variables
- read the previous changelogs

#### You'll be ready for CVE patches
### You'll be ready for CVE patches

Thirdly, you'll be ready when a upstream package releases a patch for a critical CVE.
If you're current, you can review and merge Renovate's PR quickly.

When you're behind on updates, you'll have a bad time, because you must read _more_ changelogs and make _more_ changes before you can merge the critical patch.

#### You'll look for ways to automate the updates
### You'll look for ways to automate the updates

Finally, when you're updating often, you'll start looking for ways to automate the updates.
You may start to [`automerge`](./configuration-options.md#automerge) development dependencies like Prettier, or ESLint when the linter passes.
Expand Down
11 changes: 11 additions & 0 deletions lib/config/presets/internal/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,16 @@ const staticGroups = {
},
],
},
micrometer: {
description:
"Group Micrometer packages together, e.g. 'io.micrometer:micrometer-core'.",
packageRules: [
{
groupName: 'micrometer',
matchPackageNames: ['io.micrometer:micrometer-**'],
},
],
},
nodeJs: {
description:
"Group anything that looks like Node.js together so that it's updated together.",
Expand Down Expand Up @@ -467,6 +477,7 @@ const staticGroups = {
'group:jestPlusTypes',
'group:jwtFramework',
'group:kubernetes',
'group:micrometer',
'group:phpstan',
'group:polymer',
'group:react',
Expand Down
8 changes: 4 additions & 4 deletions tools/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# syntax=docker/dockerfile:1.12.0@sha256:db1ff77fb637a5955317c7a3a62540196396d565f3dd5742e76dddbb6d75c4c5
# syntax=docker/dockerfile:1.12.1@sha256:93bfd3b68c109427185cd78b4779fc82b484b0b7618e36d0f104d4d801e66d25

ARG BASE_IMAGE_TYPE=slim

# --------------------------------------
# slim image
# --------------------------------------
FROM ghcr.io/renovatebot/base-image:9.22.4@sha256:77005817dc99d1d80179510ba4af1b6f8f7fd3e52c1f070b47f1171e8cce3e02 AS slim-base
FROM ghcr.io/renovatebot/base-image:9.23.0@sha256:70818df2f07baffb51eaf1fc87748ae5d078e1663ff46c86e35f86f764a34fc7 AS slim-base

# --------------------------------------
# full image
# --------------------------------------
FROM ghcr.io/renovatebot/base-image:9.22.4-full@sha256:86745a4a9c44e7967c234edc83827beaca07edab2799a4960e73ac886f4928b2 AS full-base
FROM ghcr.io/renovatebot/base-image:9.23.0-full@sha256:8b57c2c3aeb385e1fd1cb29f3612e04b27735c1be28910fdb5587069e3f48736 AS full-base

ENV RENOVATE_BINARY_SOURCE=global

# --------------------------------------
# build image
# --------------------------------------
FROM --platform=$BUILDPLATFORM ghcr.io/renovatebot/base-image:9.22.4@sha256:77005817dc99d1d80179510ba4af1b6f8f7fd3e52c1f070b47f1171e8cce3e02 AS build
FROM --platform=$BUILDPLATFORM ghcr.io/renovatebot/base-image:9.23.0@sha256:70818df2f07baffb51eaf1fc87748ae5d078e1663ff46c86e35f86f764a34fc7 AS build

# We want a specific node version here
# renovate: datasource=node-version
Expand Down
68 changes: 68 additions & 0 deletions tools/find-issues-with-missing-labels.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4e02f02

Please sign in to comment.