autometa commit

This commit is contained in:
Loup-Garou911XD 2026-01-05 03:00:15 +05:30
parent db4d7b8a13
commit c096985e94
8 changed files with 259 additions and 126 deletions

View file

@ -1,5 +1,15 @@
name: CI
# WORD OF CAUTION:
# TO anyone modifying this
# Things will break if you modify this
# without understanding how it works
# A simple flow of this file:
# Apply AutoPEP8 → Apply Plugin Metadata → CRITICAL COMMIT (format + plugin meta)
# ← ← ← ← ← ↵
# ↪ Apply Version Metadata → Commit (version meta) → Tests
on:
push:
branches:
@ -9,48 +19,55 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install -U pip
python -m pip install -U pycodestyle==2.12.1 autopep8
python -m pip install -U -r test/pip_reqs.txt
- name: Apply AutoPEP8
run: |
autopep8 --in-place --recursive --max-line-length=100 .
- name: Commit AutoPEP8
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[ci] auto-format"
branch: ${{ github.head_ref }}
- name: Apply Version Metadata
run: |
python test/auto_apply_version_metadata.py $(git log --pretty=format:'%h' -n 1)
- name: Commit Version Metadata
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[ci] apply-version-metadata"
branch: ${{ github.head_ref }}
- name: Execute Tests
run: |
python -m unittest discover -v
- uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install Dependencies
run: |
python -m pip install -U pip
python -m pip install -U pycodestyle==2.12.1 autopep8
python -m pip install -U -r test/pip_reqs.txt
- name: Apply AutoPEP8
run: |
autopep8 --in-place --recursive --max-line-length=100 .
- name: Apply Plugin Metadata
if: github.event_name == 'pull_request_target'
env:
GH_TOKEN: ${{ github.token }}
run: |
CHANGED_FILES=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --jq '.[].filename')
python test/auto_apply_plugin_metadata.py "$CHANGED_FILES"
# This is a CRITICAL COMMIT for the next step
# which bases this as the commit to get the sha to store in index.json or plugin.json
- name: Commit Plugin Metadata and AutoPEP8
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "[ci] apply-plugin-metadata-and-formatting"
branch: ${{ github.head_ref }}
- name: Apply Version Metadata
run: |
python test/auto_apply_version_metadata.py $(git log --pretty=format:'%h' -n 1)
- name: Commit Version Metadata
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "[ci] apply-version-metadata"
branch: ${{ github.head_ref }}
- name: Execute Tests
run: |
python -m unittest discover -v

View file

@ -12,9 +12,9 @@ jobs:
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.12'
@ -27,14 +27,14 @@ jobs:
- name: set_variables
run: |
output1=$(python3 test/get_latest.py get_latest_version)
output1=$(python3 test/get_latest.py get_latest_plugman_version)
{
echo "changelog<<EOF"
python3 test/get_changes.py "$(python3 test/get_latest.py get_latest_version)"
python3 test/get_changelog.py "$(python3 test/get_latest.py get_latest_version)"
echo EOF
} >> "$GITHUB_OUTPUT"
output2=$(python3 test/get_latest.py get_latest_api)
output3=$(python3 test/version_is_lower.py ${{ steps.previoustag.outputs.tag }})
output3=$(python3 test/versioning_tools.py ${{ steps.previoustag.outputs.tag }})
echo "latestVersion=$output1" >> $GITHUB_OUTPUT
echo "latestAPI=$output2" >> $GITHUB_OUTPUT
echo "shouldRun=$output3" >> $GITHUB_OUTPUT