pr-check: Add some more checks for PR file structure

This commit is contained in:
bbhtt
2025-09-15 08:08:14 +05:30
parent dd8b34945a
commit 1e8d9a4332

View File

@@ -101,6 +101,8 @@ jobs:
PR_THREAD_COUNT=$(gh api repos/$GH_REPO/pulls/$PR_NUM/comments \
--jq '[.[] | select(.position != null)] | length')
PR_FILES=$(gh pr view "$PR_NUM" --json files --jq '.files[].path')
COMMIT_COUNT="(gh api repos/$GH_REPO/pulls/$PR_NUM --jq '.commits')"
CONTAINS_MASTER=$(gh api repos/$GH_REPO/pulls/$PR_NUM/commits --jq '.[1] | (.commit.author.email == "mclasen@redhat.com" and .commit.message == "Add some instructions")')
@@ -161,6 +163,18 @@ jobs:
BLOCKED=1
fi
if echo "$PR_FILES" | grep -qE '.*/flathub\.json$'; then
echo "flathub.json not at toplevel"
BLOCKED=1
REVIEW_COMMENT_LINES+=("- `flathub.json` file is at toplevel")
fi
if ! echo "$PR_FILES" | grep -qE '^[^/]+\.(ya?ml|json)$'; then
echo "No JSON/YAML files at toplevel"
BLOCKED=1
REVIEW_COMMENT_LINES+=("- Flatpak manifest is at toplevel)
fi
CHECKLIST_PRESENT=$(printf "%s\n" "$PR_BODY" | grep -cE '^- ?\[[xX]\] [A-Za-z]+' || true)
echo "Total checklists found: $CHECKLIST_PRESENT"
UNCHECKED=$(printf "%s\n" "$PR_BODY" | grep -Ec '^- \[ \] [A-Za-z]+' || true)