From 1e8d9a43327b87b1121c50f894f8401eff3af38f Mon Sep 17 00:00:00 2001 From: bbhtt Date: Mon, 15 Sep 2025 08:08:14 +0530 Subject: [PATCH] pr-check: Add some more checks for PR file structure --- .github/workflows/pr-check.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index ad4bf69..6ab7ff2 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -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)