From 94cf114bfac0f23c6961e7c6032b9615fd0f2993 Mon Sep 17 00:00:00 2001 From: Spyridon Siarapis Date: Fri, 31 Jul 2026 19:15:18 +0200 Subject: [PATCH 1/2] fix(workflow): Fixed a small bug with the issues-check-for-correct-plugin workflow --- .github/workflows/scripts/issues-check-for-correct-plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scripts/issues-check-for-correct-plugin.py b/.github/workflows/scripts/issues-check-for-correct-plugin.py index 4175960e..7f19ad1c 100644 --- a/.github/workflows/scripts/issues-check-for-correct-plugin.py +++ b/.github/workflows/scripts/issues-check-for-correct-plugin.py @@ -37,4 +37,4 @@ if "--- SELECT ---" in plugin: issue.create_comment("Specify which plugin this issue is about!") - issue.edit(state='closed', state_reason='null') + issue.edit(state='closed') From 88f27ec93a6126acbad794496d07f28939d6f581 Mon Sep 17 00:00:00 2001 From: Spyridon Siarapis Date: Fri, 31 Jul 2026 19:46:04 +0200 Subject: [PATCH 2/2] feat(workflow): Added a workflow to notify plugin authors for PR's --- .../workflows/pr-notify-plugin-authors.yml | 42 +++++++++++ .../scripts/pr-notify-plugin-authors.py | 70 +++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 .github/workflows/pr-notify-plugin-authors.yml create mode 100644 .github/workflows/scripts/pr-notify-plugin-authors.py diff --git a/.github/workflows/pr-notify-plugin-authors.yml b/.github/workflows/pr-notify-plugin-authors.yml new file mode 100644 index 00000000..4a129fc5 --- /dev/null +++ b/.github/workflows/pr-notify-plugin-authors.yml @@ -0,0 +1,42 @@ +name: Notify Plugin Authors for Pull Requests + +on: + pull_request_target: + types: [opened] + paths-ignore: + - catalog.toml + - '.**' + - README.md + - README_TEMPLATE.md + workflow_dispatch: + inputs: + pull-request-number: + required: true + type: number + +permissions: + contents: read + issues: write + +jobs: + notify-plugin-authors: + runs-on: ubuntu-latest + if: github.repository == 'noctalia-dev/community-plugins' + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-python@v7 + with: + python-version: '3.14' + cache: 'pip' + cache-dependency-path: | + .github/workflows/scripts/PyGithub-requirement.txt + + - name: Install dependencies + run: pip install -r .github/workflows/scripts/PyGithub-requirement.txt + + - name: Notify Authors + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPOSITORY: ${{ github.repository }} + PULL_REQUEST_NUMBER: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pull-request-number || github.event.pull_request.number }} + run: python3 .github/workflows/scripts/pr-notify-plugin-authors.py diff --git a/.github/workflows/scripts/pr-notify-plugin-authors.py b/.github/workflows/scripts/pr-notify-plugin-authors.py new file mode 100644 index 00000000..6ac21d9f --- /dev/null +++ b/.github/workflows/scripts/pr-notify-plugin-authors.py @@ -0,0 +1,70 @@ +import os +import sys + +from github import Auth, Github + +token = os.environ["GITHUB_TOKEN"] +repo_name = os.environ["REPOSITORY"] +pull_request_number = os.environ["PULL_REQUEST_NUMBER"] + +auth = Auth.Token(token) +gh = Github(auth=auth) +repo = gh.get_repo(repo_name) + +if pull_request_number.isdigit(): + pull_request_number = int(pull_request_number) +else: + print("Pull Request number is not numeric!") + sys.exit(1) + +pull_request = repo.get_pull(pull_request_number) + +plugin_dirs = set() +hidden_dirs = set() +root_files = set() + +for file in pull_request.get_files(): + file_split = file.filename.split("/") + if len(file_split) > 1: + root_dir = file_split[0] + if root_dir.startswith('.'): + hidden_dirs.add(root_dir) + else: + plugin_dirs.add(root_dir) + else: + root_files.add(file) + +if len(plugin_dirs) > 1: + print("Multiple plugin changes in one PR!") + pull_request.create_issue_comment("This pull request was automatically closed because it contains changes for two or more plugins in one PR!") + pull_request.edit(state='closed') + sys.exit(0) +elif len(plugin_dirs) == 1: + plugin_dir = plugin_dirs.pop() + + manifest_file = f"{plugin_dir}/plugin.toml" + + if os.path.exists(manifest_file): + file_commits = repo.get_commits(path=manifest_file).reversed + author = file_commits[0].author + + if author is not None: + author = author.login + else: + print("Author name is null, returning!") + sys.exit(1) + else: + print(f"Plugin manifest doesn't exist, {manifest_file}") + sys.exit(0) +else: + print("This is a non-plugin change, returning!") + sys.exit(0) + + +pr_author = pull_request.user.login + +if pr_author == author: + print("The author and maintainer of the plugin are the same!") + sys.exit(0) +else: + pull_request.create_issue_comment(f"CC @{author}")