From e3696d8b4df3177c4199b2ecef2ef8ff2361c681 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Fri, 6 Oct 2023 16:17:09 +0200 Subject: [PATCH] MAINT: move `labels` configuration to `labels/` folder (#196) --- .cspell.json | 1 + .github/workflows/sync-labels.yml | 20 ++++++++++---------- .pre-commit-config.yaml | 2 +- .taplo.toml | 1 + labels.toml => labels/default.toml | 0 labels-physics.toml => labels/physics.toml | 0 src/repoma/check_dev_files/github_labels.py | 2 +- src/repoma/check_dev_files/toml.py | 8 +++----- 8 files changed, 17 insertions(+), 17 deletions(-) rename labels.toml => labels/default.toml (100%) rename labels-physics.toml => labels/physics.toml (100%) diff --git a/.cspell.json b/.cspell.json index e90954d5..6c60bfac 100644 --- a/.cspell.json +++ b/.cspell.json @@ -39,6 +39,7 @@ "docs/adr/*/*", "docs/conf.py", "labels.toml", + "labels/*.toml", "Makefile", "Manifest.toml", "Project.toml", diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 36a482a1..ce8929c6 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -22,15 +22,15 @@ jobs: pip install labels - name: Sync general issue labels run: | - labels sync -o ComPWA -r ampform - labels sync -o ComPWA -r benchmarks - labels sync -o ComPWA -r compwa-org - labels sync -o ComPWA -r RUB-EP1-AG - labels sync -o ComPWA -r qrules - labels sync -o ComPWA -r repo-maintenance - labels sync -o ComPWA -r sphinxcontrib-hep-pdgref - labels sync -o ComPWA -r tensorwaves - labels sync -o ComPWA -r update-pip-constraints + labels sync --filename labels/default.toml --owner ComPWA --repo ampform + labels sync --filename labels/default.toml --owner ComPWA --repo benchmarks + labels sync --filename labels/default.toml --owner ComPWA --repo compwa-org + labels sync --filename labels/default.toml --owner ComPWA --repo RUB-EP1-AG + labels sync --filename labels/default.toml --owner ComPWA --repo qrules + labels sync --filename labels/default.toml --owner ComPWA --repo repo-maintenance + labels sync --filename labels/default.toml --owner ComPWA --repo sphinxcontrib-hep-pdgref + labels sync --filename labels/default.toml --owner ComPWA --repo tensorwaves + labels sync --filename labels/default.toml --owner ComPWA --repo update-pip-constraints - name: Sync issue labels for physics repositories run: | - labels sync --filename labels-physics.toml -o ComPWA -r PWA-pages + labels sync --filename labels/physics.toml --owner ComPWA --repo PWA-pages diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5c35eee7..b636e322 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -126,4 +126,4 @@ repos: - id: toml-sort args: - --in-place - exclude: (?x)^(labels.toml|labels-physics.toml)$ + exclude: (?x)^(labels/.*\.toml)$ diff --git a/.taplo.toml b/.taplo.toml index 424b7469..0d0d4461 100644 --- a/.taplo.toml +++ b/.taplo.toml @@ -3,6 +3,7 @@ exclude = [ "**/Manifest.toml", "**/Project.toml", "labels*.toml", + "labels/*.toml", ] [formatting] diff --git a/labels.toml b/labels/default.toml similarity index 100% rename from labels.toml rename to labels/default.toml diff --git a/labels-physics.toml b/labels/physics.toml similarity index 100% rename from labels-physics.toml rename to labels/physics.toml diff --git a/src/repoma/check_dev_files/github_labels.py b/src/repoma/check_dev_files/github_labels.py index eb8c9ec9..aca1afd8 100644 --- a/src/repoma/check_dev_files/github_labels.py +++ b/src/repoma/check_dev_files/github_labels.py @@ -1,4 +1,4 @@ -"""Check whether the repository (still) contains a ``labels.toml`` file. +"""Check whether the repository (still) contains a :file:`labels.toml` file. If it's still there remove it, because it is now managed through https://github.com/ComPWA/repo-maintenance. diff --git a/src/repoma/check_dev_files/toml.py b/src/repoma/check_dev_files/toml.py index eae33258..4a8370b0 100644 --- a/src/repoma/check_dev_files/toml.py +++ b/src/repoma/check_dev_files/toml.py @@ -1,7 +1,7 @@ """Configuration for working with TOML files.""" - import os import shutil +from glob import glob from pathlib import Path from typing import List, Union @@ -73,10 +73,8 @@ def _update_tomlsort_hook() -> None: repo="https://github.com/pappasam/toml-sort", hooks=[CommentedMap(id="toml-sort", args=["--in-place"])], ) - excludes = ["labels.toml", "labels-physics.toml"] - excludes = [f for f in excludes if os.path.exists(f)] - if excludes: - expected_hook["hooks"][0]["exclude"] = "(?x)^(" + "|".join(excludes) + ")$" + if glob("labels/*.toml"): + expected_hook["hooks"][0]["exclude"] = r"(?x)^(labels/.*\.toml)$" update_single_hook_precommit_repo(expected_hook)