This commit is contained in:
Loup-Garou911XD 2025-12-10 21:09:38 +05:30
parent 14ad3668b3
commit 0ba189615c
3 changed files with 12 additions and 9 deletions

View file

@ -2,11 +2,11 @@ name: CI
# WORD OF CAUTION: # WORD OF CAUTION:
# TO anyone modifying this # TO anyone modifying this
# Things will break if you modify this # Things will break if you modify this
# without understanding how it works # without understanding how it works
# A simple flow of this file: # A simple flow of this file:
# Apply AutoPEP8 → Apply Plugin Metadata → CRITICAL COMMIT (format + plugin meta) # Apply AutoPEP8 → Apply Plugin Metadata → CRITICAL COMMIT (format + plugin meta)
# ← ← ← ← ← ↵ # ← ← ← ← ← ↵
# ↪ Apply Version Metadata → Commit (version meta) → Tests # ↪ Apply Version Metadata → Commit (version meta) → Tests
@ -24,6 +24,7 @@ jobs:
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
@ -42,10 +43,10 @@ jobs:
- name: Apply Plugin Metadata - name: Apply Plugin Metadata
if: github.event_name == 'pull_request_target' if: github.event_name == 'pull_request_target'
# should this only be run on pull_request_target and not pushes?? env:
GH_TOKEN: ${{ github.token }}
run: | run: |
LAST_COMMIT_HASH=$(git log --pretty=format:'%H' -n 1) CHANGED_FILES=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --jq '.[].filename')
CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r "$LAST_COMMIT_HASH")
python test/auto_apply_plugin_metadata.py "$CHANGED_FILES" python test/auto_apply_plugin_metadata.py "$CHANGED_FILES"
# This is a CRITICAL COMMIT for the next step # This is a CRITICAL COMMIT for the next step

View file

@ -7,6 +7,8 @@ import versioning_tools
DEBUG = True DEBUG = True
print("DOES THIS RUN AUTO APPLY PLUGIN METADATA?")
def debug_print(*args, **kwargs): def debug_print(*args, **kwargs):
if DEBUG: if DEBUG:

View file

@ -1,5 +1,5 @@
import sys import sys
from get_latest import get_latest_version from get_latest import get_latest_plugman_version
"""if called directly from command line, it will check if given version is lower """if called directly from command line, it will check if given version is lower
than latest version in index.json""" than latest version in index.json"""
@ -17,9 +17,9 @@ def semantic_to_str(semantic_version: str):
return out return out
def version_is_lower(version: str): def plugman_version_is_lower_than(version: str):
"""Check if given version is lower than the latest entry in index.json""" """Check if given version is lower than the latest entry in index.json"""
latest = semantic_to_str(get_latest_version()) latest = semantic_to_str(get_latest_plugman_version())
version = semantic_to_str(version) version = semantic_to_str(version)
if latest > version: if latest > version:
return True return True
@ -33,5 +33,5 @@ if __name__ == "__main__":
sys.exit(1) sys.exit(1)
version = sys.argv[1].replace("v", "", 1) version = sys.argv[1].replace("v", "", 1)
out = version_is_lower(version) out = plugman_version_is_lower_than(version)
print(int(out)) print(int(out))