From d151d6ce6f698b4dbdf87ccf336ce1a12b21bdee Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Tue, 2 Jan 2024 12:14:41 +0100 Subject: [PATCH 1/3] ci: migrate labeler configuration to the new format Turns out updating the labeler action is a bit annoying[0], so the breaking change wasn't detected in the version bump PR. [0] https://github.com/actions/labeler/#notes-regarding-pull_request_target-event Follow-up to f88c9b0728. --- .github/labeler.yml | 203 +++++++++++++++++++++++++++----------------- 1 file changed, 123 insertions(+), 80 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index fd5fc9113b..3cfc05d193 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,140 +1,183 @@ # SPDX-License-Identifier: LGPL-2.1-or-later +# vi: sw=2 ts=2 et: apparmor: - - '**/*apparmor*' + - changed-files: + - any-glob-to-any-file: '**/*apparmor*' binfmt: - - '**/*binfmt*' + - changed-files: + - any-glob-to-any-file: '**/*binfmt*' btrfs: - - '**/*btrfs*' + - changed-files: + - any-glob-to-any-file: '**/*btrfs*' build-system: - - meson_options.txt - - '**/meson.build' - - Makefile - - configure + - changed-files: + - any-glob-to-any-file: ['meson_options.txt', '**/meson.build', 'Makefile', 'configure'] busctl: - - '**/*busctl*' + - changed-files: + - any-glob-to-any-file: '**/*busctl*' cgls: - - '**/*cgls*' + - changed-files: + - any-glob-to-any-file: '**/*cgls*' cgtop: - - '**/*cgtop*' + - changed-files: + - any-glob-to-any-file: '**/*cgtop*' ci: - - '.github/*' + - changed-files: + - any-glob-to-any-file: '.github/*' coccinelle: - - coccinelle/* + - changed-files: + - any-glob-to-any-file: 'coccinelle/*' coredump: - - '**/*coredump*' + - changed-files: + - any-glob-to-any-file: '**/*coredump*' documentation: - - NEWS - - README* - - docs/* - - man/* + - changed-files: + - any-glob-to-any-file: ['NEWS', 'README*', 'docs/*', 'man/*'] env-generator: - - '**/*environment*generator*' + - changed-files: + - any-glob-to-any-file: '**/*environment*generator*' debug-generator: - - '**/debug-generator*' + - changed-files: + - any-glob-to-any-file: '**/debug-generator*' fstab-generator: - - '**/*fstab-generator*' + - changed-files: + - any-glob-to-any-file: '**/*fstab-generator*' growfs: - - '**/*growfs*' + - changed-files: + - any-glob-to-any-file: '**/*growfs*' hwdb: - - hwdb.d/**/* + - changed-files: + - any-glob-to-any-file: 'hwdb.d/**/*' journal: - - src/journal/* - - src/libsystemd/sd-journal/* + - changed-files: + - any-glob-to-any-file: ['src/journal/*', 'src/libsystemd/sd-journal/*'] journal-remote: - - src/journal-remote/* + - changed-files: + - any-glob-to-any-file: 'src/journal-remote/*' meson: - - meson_options.txt - - '**/meson.build' + - changed-files: + - any-glob-to-any-file: ['meson_options.txt', '**/meson.build'] mkosi: - - .mkosi/* - - mkosi.build + - changed-files: + - any-glob-to-any-file: ['.mkosi/*', 'mkosi.build'] network: - - src/libsystemd-network/**/* - - src/network/**/* + - changed-files: + - any-glob-to-any-file: ['src/libsystemd-network/**/*', 'src/network/**/*'] portable: - - src/portable/**/* + - changed-files: + - any-glob-to-any-file: 'src/portable/**/*' rc-local-generator: - - src/rc-local-generator/* + - changed-files: + - any-glob-to-any-file: 'src/rc-local-generator/*' repart: - - '**/*repart*' + - changed-files: + - any-glob-to-any-file: '**/*repart*' resolve: - - '**/*resolve*' + - changed-files: + - any-glob-to-any-file: '**/*resolve*' rfkill: - - '**/*rfkill*' + - changed-files: + - any-glob-to-any-file: '**/*rfkill*' rpm: - - src/rpm/* + - changed-files: + - any-glob-to-any-file: 'src/rpm/*' run: - - src/run/* - - man/systemd-run* + - changed-files: + - any-glob-to-any-file: ['src/run/*', 'man/systemd-run*'] sd-boot/sd-stub/bootctl: - - src/boot/**/* - - man/bootctl* - - man/systemd-boot.xml + - changed-files: + - any-glob-to-any-file: ['src/boot/**/*', 'man/bootctl*', 'man/systemd-boot.xml'] sd-bus: - - '**/sd-bus*/**' + - changed-files: + - any-glob-to-any-file: '**/sd-bus*/**' sd-daemon: - - '**/sd-daemon*/**' + - changed-files: + - any-glob-to-any-file: '**/sd-daemon*/**' sd-device: - - '**/sd-device*/**' + - changed-files: + - any-glob-to-any-file: '**/sd-device*/**' sd-event: - - '**/sd-event*/**' + - changed-files: + - any-glob-to-any-file: '**/sd-event*/**' sd-hwdb: - - '**/sd-hwdb*/**' + - changed-files: + - any-glob-to-any-file: '**/sd-hwdb*/**' sd-id128: - - '**/sd-id128*/**' + - changed-files: + - any-glob-to-any-file: '**/sd-id128*/**' sd-netlink: - - '**/sd-netlink*/**' + - changed-files: + - any-glob-to-any-file: '**/sd-netlink*/**' sd-path: - - '**/sd-path*/**' + - changed-files: + - any-glob-to-any-file: '**/sd-path*/**' sd-resolve: - - '**/sd-resolve*/**' + - changed-files: + - any-glob-to-any-file: '**/sd-resolve*/**' selinux: - - '**/*selinux*' + - changed-files: + - any-glob-to-any-file: '**/*selinux*' sleep: - - '**/*sleep*' + - changed-files: + - any-glob-to-any-file: ['src/shared/*sleep*', 'src/sleep/*'] smack: - - '**/*smack*' + - changed-files: + - any-glob-to-any-file: '**/*smack*' socket-proxy: - - '**/*socket-proxy*' + - changed-files: + - any-glob-to-any-file: '**/*socket-proxy*' sysv-generator: - - '**/*sysv-generator*' + - changed-files: + - any-glob-to-any-file: '**/*sysv-generator*' systemctl: - - '**/systemctl*' + - changed-files: + - any-glob-to-any-file: '**/systemctl*' sysupdate: - - '**/*sysupdate*' + - changed-files: + - any-glob-to-any-file: '**/*sysupdate*' sysvcompat: - - '**/*sysv*' + - changed-files: + - any-glob-to-any-file: '**/*sysv*' sysctl: - - '**/*sysctl*' + - changed-files: + - any-glob-to-any-file: '**/*sysctl*' timedate: - - '**/*timedate*' + - changed-files: + - any-glob-to-any-file: '**/*timedate*' timesync: - - '**/*timesync*' + - changed-files: + - any-glob-to-any-file: '**/*timesync*' tests: - - src/test/**/* - - src/fuzz/**/* - - test/**/* - - '**/test-*' - - .github/workflows/* + - changed-files: + - any-glob-to-any-file: [ + 'src/test/**/*', + 'src/fuzz/**/*', + 'test/**/*', + '**/test-*', + '.github/workflows/*' + ] tpm2: - - '**/*tpm2*' - - '**/*tpm-*' + - changed-files: + - any-glob-to-any-file: ['**/*tpm2*', '**/*tpm-*'] udev: - - src/udev/**/* - - src/libudev/* - - man/*udev* + - changed-files: + - any-glob-to-any-file: ['src/udev/**/*', 'src/libudev/*', 'man/*udev*'] uki: - - '**/ukify*' + - changed-files: + - any-glob-to-any-file: '**/ukify*' units: - - units/**/* + - changed-files: + - any-glob-to-any-file: 'units/**/*' userdb: - - '**/*userdb*' + - changed-files: + - any-glob-to-any-file: '**/*userdb*' util-lib: - - src/fundamental/**/* - - src/basic/**/* - - src/shared/**/* + - changed-files: + - any-glob-to-any-file: ['src/fundamental/**/*', 'src/basic/**/*', 'src/shared/**/*'] vconsole: - - '**/*vconsole*' + - changed-files: + - any-glob-to-any-file: '**/*vconsole*' xdg-autostart: - - '**/**xdg-autostart-generator*' + - changed-files: + - any-glob-to-any-file: '**/**xdg-autostart-generator*' From 17b056a340ce489ba747b797de8b270af30d66c4 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Tue, 2 Jan 2024 12:18:52 +0100 Subject: [PATCH 2/3] ci: use a boolean value for the boolean field The issue[0] behind this workaround has been resolved[1], so we can set it to a proper boolean field. [0] https://github.com/systemd/systemd/issues/18671 [1] https://github.com/actions/labeler/pull/480 --- .github/workflows/labeler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 3425e68dac..e739772829 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -27,7 +27,7 @@ jobs: with: repo-token: "${{ secrets.GITHUB_TOKEN }}" configuration-path: .github/labeler.yml - sync-labels: "" # This is a workaround for issue 18671 + sync-labels: false - name: Set or remove labels based on systemd development workflow uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea From b3fb73a5f2df6fe7c3963789fc47296cc1ae9574 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Tue, 2 Jan 2024 12:38:09 +0100 Subject: [PATCH 3/3] ci: allow testing changes made to labeler configuration --- .github/workflows/labeler.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index e739772829..559f589dbf 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -7,6 +7,14 @@ name: "Pull Request Labeler" on: pull_request_target: types: [opened, synchronize, reopened, ready_for_review, closed] + paths-ignore: + - '.github/labeler.yml' + - '.github/workflows/labeler.yml' + # Allow testing changes made to the labeler configuration + pull_request: + paths: + - '.github/labeler.yml' + - '.github/workflows/labeler.yml' issue_comment: types: [created] @@ -21,9 +29,13 @@ jobs: pull-requests: write steps: + - name: Repository checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + if: github.event_name == 'pull_request' + - name: Label PR based on policy in labeler.yml uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 - if: github.event_name == 'pull_request_target' && github.event.action != 'closed' + if: startsWith(github.event_name, 'pull_request') && github.event.action != 'closed' with: repo-token: "${{ secrets.GITHUB_TOKEN }}" configuration-path: .github/labeler.yml @@ -31,7 +43,7 @@ jobs: - name: Set or remove labels based on systemd development workflow uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea - if: github.event_name == 'pull_request_target' && github.event.action != 'closed' && !github.event.pull_request.draft + if: startsWith(github.event_name, 'pull_request') && github.event.action != 'closed' && !github.event.pull_request.draft with: script: | response = await github.rest.issues.listLabelsOnIssue({ @@ -88,7 +100,7 @@ jobs: - name: Remove specific labels when PR is closed or merged uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea - if: github.event_name == 'pull_request_target' && github.event.action == 'closed' + if: startsWith(github.event_name, 'pull_request') && github.event.action == 'closed' with: script: | for (const label of ["please-review",