Merge validation fixes from main
Some checks failed
Validate Plugin PR / validate (pull_request) Failing after 8s
Some checks failed
Validate Plugin PR / validate (pull_request) Failing after 8s
This commit is contained in:
@@ -160,12 +160,16 @@ for (const file of changedFiles) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adjust file paths based on working directory
|
||||||
|
const prFilePath = process.env.PR_FILES_DIR ? `${process.env.PR_FILES_DIR}/${file.replace('plugins/', '')}` : file;
|
||||||
|
const baseFilePath = file;
|
||||||
|
|
||||||
// Check if file was added or removed
|
// Check if file was added or removed
|
||||||
let isAdded = false;
|
let isAdded = false;
|
||||||
let isRemoved = false;
|
let isRemoved = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await access(file);
|
await access(prFilePath);
|
||||||
isAdded = true;
|
isAdded = true;
|
||||||
} catch {
|
} catch {
|
||||||
isRemoved = true;
|
isRemoved = true;
|
||||||
@@ -174,7 +178,7 @@ for (const file of changedFiles) {
|
|||||||
if (isAdded) {
|
if (isAdded) {
|
||||||
// Validate added/modified plugin
|
// Validate added/modified plugin
|
||||||
try {
|
try {
|
||||||
const content = await readFile(file, 'utf-8');
|
const content = await readFile(prFilePath, 'utf-8');
|
||||||
const plugin = JSON.parse(content);
|
const plugin = JSON.parse(content);
|
||||||
|
|
||||||
// Check if this plugin already exists on main
|
// Check if this plugin already exists on main
|
||||||
@@ -182,7 +186,7 @@ for (const file of changedFiles) {
|
|||||||
let originalAuthor = null;
|
let originalAuthor = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const originalContent = await readFile(`../base/${file}`, 'utf-8');
|
const originalContent = await readFile(baseFilePath, 'utf-8');
|
||||||
const originalPlugin = JSON.parse(originalContent);
|
const originalPlugin = JSON.parse(originalContent);
|
||||||
isModification = true;
|
isModification = true;
|
||||||
originalAuthor = originalPlugin.author;
|
originalAuthor = originalPlugin.author;
|
||||||
@@ -243,7 +247,7 @@ for (const file of changedFiles) {
|
|||||||
} else if (isRemoved) {
|
} else if (isRemoved) {
|
||||||
// For removed files, check the original author from main branch
|
// For removed files, check the original author from main branch
|
||||||
try {
|
try {
|
||||||
const originalContent = await readFile(`../base/${file}`, 'utf-8');
|
const originalContent = await readFile(baseFilePath, 'utf-8');
|
||||||
const originalPlugin = JSON.parse(originalContent);
|
const originalPlugin = JSON.parse(originalContent);
|
||||||
|
|
||||||
if (originalPlugin.author !== prAuthor) {
|
if (originalPlugin.author !== prAuthor) {
|
||||||
|
|||||||
@@ -67,12 +67,15 @@ jobs:
|
|||||||
|
|
||||||
- name: Validate PR (using trusted validation script from main)
|
- name: Validate PR (using trusted validation script from main)
|
||||||
run: |
|
run: |
|
||||||
node base/.gitea/scripts/validate-pr.js "${{ github.event.pull_request.user.login }}" "${{ steps.changed-files.outputs.files }}"
|
cd base
|
||||||
working-directory: pr
|
node .gitea/scripts/validate-pr.js "${{ github.event.pull_request.user.login }}" "${{ steps.changed-files.outputs.files }}"
|
||||||
|
env:
|
||||||
|
PR_FILES_DIR: ../pr/plugins
|
||||||
|
|
||||||
- name: Auto-merge PR
|
- name: Auto-merge PR
|
||||||
if: success()
|
if: success()
|
||||||
run: |
|
run: |
|
||||||
|
cd pr
|
||||||
echo "✅ Validation passed - Auto-merging PR"
|
echo "✅ Validation passed - Auto-merging PR"
|
||||||
git config user.name "GitHub Actions"
|
git config user.name "GitHub Actions"
|
||||||
git config user.email "actions@github.com"
|
git config user.email "actions@github.com"
|
||||||
|
|||||||
Reference in New Issue
Block a user