Files
fleet/.github/workflows/check-pr-template.yml
T
Lucas Manuel Rodriguez c3d6c1861f Reduce scope of check-pr-template.yml (#47347)
Only run this check on PRs that have Go and frontend changes.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Updated CI/CD workflow configuration to optimize PR validation
triggers based on affected file paths.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-06-10 15:08:19 -03:00

44 lines
1.5 KiB
YAML

name: Check PR template
on:
pull_request:
types: [opened, edited, reopened, synchronize]
paths:
- "frontend/**"
- "**/*.go"
- "go.mod"
- "go.sum"
permissions:
pull-requests: read
jobs:
check-template:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Verify PR body contains the PR template
env:
BODY: ${{ github.event.pull_request.body }}
AUTHOR: ${{ github.event.pull_request.user.login }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
# Exempt the automated release author
if [ "$AUTHOR" = "fleet-release" ]; then
echo "Author is fleet-release; skipping PR template check."
exit 0
fi
# Exempt PRs whose changed files are ALL under exempt paths
files=$(gh api --paginate "repos/$REPO/pulls/$PR_NUMBER/files" --jq '.[].filename')
if [ -n "$files" ] && ! grep -qvE '^(ee/maintained-apps/|it-and-security/)' <<< "$files"; then
echo "All changed files are under exempt paths; skipping PR template check."
exit 0
fi
marker="QA'd all new/changed functionality manually"
if ! grep -qF "$marker" <<< "$BODY"; then
echo "::error::PR description is missing the PR template. Please fill in .github/pull_request_template.md (expected line: \"$marker\")."
exit 1
fi
echo "PR template present."