feat(workflow): Multiple fixes in one (#160)
* fix(workflow): Re-organized the workflow, put the scripts in their own scripts folder * fix(workflow): Fixed so that we have a default SELECT selection in the issue templates * fix(workflow): Added a way to run the issue workflows manually as well * feat(workflow): Added workflow for closing issues with no selected plugin * fix(workflow): Changed so that we only use one file for jobs that only care about the plugin folders * fix(workflows): resolve repository root after script move --------- Co-authored-by: Lemmy <studio@quadbyte.net>
This commit is contained in:
co-authored by
Lemmy
parent
68d904fcea
commit
9b2179899b
@@ -0,0 +1,37 @@
|
|||||||
|
name: Check for the correct plugin format in issues
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
issue-number:
|
||||||
|
required: true
|
||||||
|
type: number
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-for-correct-plugin:
|
||||||
|
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 }}
|
||||||
|
ISSUE_NUMBER: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.issue-number || github.event.issue.number }}
|
||||||
|
run: python3 .github/workflows/scripts/issues-check-for-correct-plugin.py
|
||||||
@@ -3,6 +3,11 @@ name: Notify Plugin Authors for Issues
|
|||||||
on:
|
on:
|
||||||
issues:
|
issues:
|
||||||
types: [opened]
|
types: [opened]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
issue-number:
|
||||||
|
required: true
|
||||||
|
type: number
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -19,14 +24,14 @@ jobs:
|
|||||||
python-version: '3.14'
|
python-version: '3.14'
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
cache-dependency-path: |
|
cache-dependency-path: |
|
||||||
.github/workflows/notify-plugin-authors-requirements.txt
|
.github/workflows/scripts/PyGithub-requirement.txt
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pip install -r .github/workflows/notify-plugin-authors-requirements.txt
|
run: pip install -r .github/workflows/scripts/PyGithub-requirement.txt
|
||||||
|
|
||||||
- name: Notify Authors
|
- name: Notify Authors
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
REPOSITORY: ${{ github.repository }}
|
REPOSITORY: ${{ github.repository }}
|
||||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
ISSUE_NUMBER: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.issue-number || github.event.issue.number }}
|
||||||
run: python3 .github/workflows/issues-notify-plugin-authors.py
|
run: python3 .github/workflows/scripts/issues-notify-plugin-authors.py
|
||||||
|
|||||||
@@ -3,6 +3,11 @@ name: Update title of issue to represent the plugin
|
|||||||
on:
|
on:
|
||||||
issues:
|
issues:
|
||||||
types: [opened]
|
types: [opened]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
issue-number:
|
||||||
|
required: true
|
||||||
|
type: number
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -19,15 +24,15 @@ jobs:
|
|||||||
python-version: '3.14'
|
python-version: '3.14'
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
cache-dependency-path: |
|
cache-dependency-path: |
|
||||||
.github/workflows/notify-plugin-authors-requirements.txt
|
.github/workflows/scripts/PyGithub-requirement.txt
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pip install -r .github/workflows/notify-plugin-authors-requirements.txt
|
run: pip install -r .github/workflows/scripts/PyGithub-requirement.txt
|
||||||
|
|
||||||
- name: Update Issue Title
|
- name: Update Issue Title
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
REPOSITORY: ${{ github.repository }}
|
REPOSITORY: ${{ github.repository }}
|
||||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
ISSUE_NUMBER: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.issue-number || github.event.issue.number }}
|
||||||
run: python3 .github/workflows/issues-update-title.py
|
run: python3 .github/workflows/scripts/issues-update-title.py
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,56 @@
|
|||||||
name: Update Issue Templates
|
name: Jobs to run on push to main
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
|
- catalog.toml
|
||||||
- '.**'
|
- '.**'
|
||||||
|
- README.md
|
||||||
|
- README_TEMPLATE.md
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: update-issue-templates-${{ github.ref }}
|
group: on-push-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
update-catalog:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
if: ${{ github.repository == 'noctalia-dev/community-plugins' }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Rebuild catalog
|
||||||
|
run: python3 .github/workflows/scripts/update-catalog.py
|
||||||
|
|
||||||
|
- name: Check for changes
|
||||||
|
id: check_changes
|
||||||
|
run: |
|
||||||
|
git add catalog.toml
|
||||||
|
if git diff --cached --quiet catalog.toml; then
|
||||||
|
echo "changed=false" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "No changes to catalog.toml"
|
||||||
|
else
|
||||||
|
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Changes detected in catalog.toml"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
if: steps.check_changes.outputs.changed == 'true'
|
||||||
|
run: |
|
||||||
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git config --local user.name "github-actions[bot]"
|
||||||
|
git commit -m "chore: update plugin catalog [skip ci]"
|
||||||
|
git push
|
||||||
|
|
||||||
update-issue-templates:
|
update-issue-templates:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
@@ -26,13 +64,12 @@ jobs:
|
|||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Update Issue Templates
|
- name: Update Issue Templates
|
||||||
run: python3 .github/workflows/update-issue-templates.py
|
run: python3 .github/workflows/scripts/update-issue-templates.py
|
||||||
|
|
||||||
- name: Check for changes
|
- name: Check for changes
|
||||||
id: check_changes
|
id: check_changes
|
||||||
run: |
|
run: |
|
||||||
git add .github/ISSUE_TEMPLATE/bug_report.yml .github/ISSUE_TEMPLATE/feature_request.yml
|
git add .github/ISSUE_TEMPLATE/bug_report.yml .github/ISSUE_TEMPLATE/feature_request.yml
|
||||||
|
|
||||||
if git diff --quiet --cached -- .github/ISSUE_TEMPLATE/bug_report.yml && git diff --quiet --cached -- .github/ISSUE_TEMPLATE/feature_request.yml; then
|
if git diff --quiet --cached -- .github/ISSUE_TEMPLATE/bug_report.yml && git diff --quiet --cached -- .github/ISSUE_TEMPLATE/feature_request.yml; then
|
||||||
echo "changed=false" >> "$GITHUB_OUTPUT"
|
echo "changed=false" >> "$GITHUB_OUTPUT"
|
||||||
echo "No changes found in the issue templates!"
|
echo "No changes found in the issue templates!"
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from github import Auth, Github
|
||||||
|
|
||||||
|
token = os.environ["GITHUB_TOKEN"]
|
||||||
|
repo_name = os.environ["REPOSITORY"]
|
||||||
|
issue_number = os.environ["ISSUE_NUMBER"]
|
||||||
|
|
||||||
|
auth = Auth.Token(token)
|
||||||
|
gh = Github(auth=auth)
|
||||||
|
repo = gh.get_repo(repo_name)
|
||||||
|
|
||||||
|
if issue_number.isdigit():
|
||||||
|
issue_number = int(issue_number)
|
||||||
|
else:
|
||||||
|
print("Issue number is not numeric!")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
issue = repo.get_issue(issue_number)
|
||||||
|
body = issue.body
|
||||||
|
lines = body.splitlines()
|
||||||
|
|
||||||
|
try:
|
||||||
|
title_index = lines.index("### Plugin")
|
||||||
|
except ValueError:
|
||||||
|
print("No Plugin title found!")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
for i in range(title_index + 1, len(lines)):
|
||||||
|
if lines[i]:
|
||||||
|
break
|
||||||
|
|
||||||
|
plugin = lines[i].strip()
|
||||||
|
|
||||||
|
if "--- SELECT ---" in plugin:
|
||||||
|
issue.create_comment("Specify which plugin this issue is about!")
|
||||||
|
issue.edit(state='closed', state_reason='null')
|
||||||
@@ -9,7 +9,7 @@ import tomllib
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
ROOT_DIR = Path(__file__).resolve().parents[2]
|
ROOT_DIR = Path(__file__).resolve().parents[3]
|
||||||
CATALOG_PATH = ROOT_DIR / "catalog.toml"
|
CATALOG_PATH = ROOT_DIR / "catalog.toml"
|
||||||
REQUIRED_FIELDS = ("id", "name", "version", "author", "plugin_api", "tags")
|
REQUIRED_FIELDS = ("id", "name", "version", "author", "plugin_api", "tags")
|
||||||
OPTIONAL_STRING_FIELDS = ("license", "icon", "description")
|
OPTIONAL_STRING_FIELDS = ("license", "icon", "description")
|
||||||
+3
-1
@@ -11,9 +11,11 @@ def build_dropdown_component(plugins: list[str]) -> str:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Plugin
|
label: Plugin
|
||||||
description: The plugin id.
|
description: The plugin id.
|
||||||
|
default: 0
|
||||||
options:
|
options:
|
||||||
|
- --- SELECT ---
|
||||||
{
|
{
|
||||||
"\n".join([f"""\
|
"".join([f"""\
|
||||||
- {plugin}
|
- {plugin}
|
||||||
""" for plugin in plugins])
|
""" for plugin in plugins])
|
||||||
}
|
}
|
||||||
+1
-1
@@ -12,7 +12,7 @@ from pathlib import Path
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_ROOT = Path(__file__).resolve().parents[2]
|
DEFAULT_ROOT = Path(__file__).resolve().parents[3]
|
||||||
SEMVER_RE = re.compile(r"^\d+\.\d+\.\d+$")
|
SEMVER_RE = re.compile(r"^\d+\.\d+\.\d+$")
|
||||||
LAUNCHER_PREFIX_RE = re.compile(r"^[a-z]+$")
|
LAUNCHER_PREFIX_RE = re.compile(r"^[a-z]+$")
|
||||||
DESCRIPTION_MAX_CHARS = 120
|
DESCRIPTION_MAX_CHARS = 120
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
name: Update Plugin Catalog
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths-ignore:
|
|
||||||
- catalog.toml
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: update-plugin-catalog-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update-catalog:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
if: ${{ github.repository == 'noctalia-dev/community-plugins' }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v7
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Rebuild catalog
|
|
||||||
run: python3 .github/workflows/update-catalog.py
|
|
||||||
|
|
||||||
- name: Check for changes
|
|
||||||
id: check_changes
|
|
||||||
run: |
|
|
||||||
git add catalog.toml
|
|
||||||
if git diff --cached --quiet catalog.toml; then
|
|
||||||
echo "changed=false" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "No changes to catalog.toml"
|
|
||||||
else
|
|
||||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "Changes detected in catalog.toml"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Commit and push changes
|
|
||||||
if: steps.check_changes.outputs.changed == 'true'
|
|
||||||
run: |
|
|
||||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
git config --local user.name "github-actions[bot]"
|
|
||||||
git commit -m "chore: update plugin catalog [skip ci]"
|
|
||||||
git push
|
|
||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Validate plugin manifests
|
- name: Validate plugin manifests
|
||||||
run: python3 .github/workflows/validate-plugins.py
|
run: python3 .github/workflows/scripts/validate-plugins.py
|
||||||
|
|
||||||
- name: Test plugin validator
|
- name: Test plugin validator
|
||||||
run: python3 -m unittest discover -s .github/workflows -p 'test_*.py'
|
run: python3 -m unittest discover -s .github/workflows/scripts -p 'test_*.py'
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
# Editor type definitions, fetched from official-plugins (see README).
|
# Editor type definitions, fetched from official-plugins (see README).
|
||||||
/noctalia.d.luau
|
/noctalia.d.luau
|
||||||
|
|
||||||
/.github/workflows/__pycache__
|
/.github/workflows/scripts/__pycache__
|
||||||
|
|||||||
Reference in New Issue
Block a user