Skip to content

Commit 1e1c079

Browse files
authored
chore(ci): add PR summary using $GITHUB_STEP_SUMMARY
Add .github/workflows/pr-summary.yml. Triggers on PR open/sync/reopen/ready_for_review. Writes metrics to $GITHUB_STEP_SUMMARY and posts a PR comment for non-forks. Minimal perms (contents: read, pull-requests: write). 5-min timeout, concurrency cancel-in-progress, no secrets. No impact on build or tests. Verification: counts computed via git diff origin/<base>...<head>. Happy to align naming/filters.
1 parent 2fd1fbc commit 1e1c079

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/pr-summary.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: PR summary
2+
on:
3+
pull_request: { types: [opened, synchronize, reopened, ready_for_review] }
4+
permissions: { contents: read, pull-requests: write }
5+
concurrency: { group: pr-summary-${{ github.ref }}, cancel-in-progress: true }
6+
jobs:
7+
summary:
8+
runs-on: ubuntu-latest
9+
timeout-minutes: 5
10+
steps:
11+
- uses: actions/checkout@v4
12+
with: { fetch-depth: 0 }
13+
- name: Write step summary
14+
run: |
15+
base="${{ github.base_ref }}"; head="${{ github.sha }}"
16+
echo "## Pull request summary" >> "$GITHUB_STEP_SUMMARY"
17+
echo "- Changed files: $(git diff --name-only origin/$base...$head | wc -l)" >> "$GITHUB_STEP_SUMMARY"
18+
echo "- Docs files: $(git diff --name-only origin/$base...$head | grep -E '(^content/|\\.md$)' | wc -l)" >> "$GITHUB_STEP_SUMMARY"
19+
- name: Comment on PR (non-forks)
20+
if: ${{ github.event.pull_request.head.repo.fork == false }}
21+
env: { GH_TOKEN: ${{ github.token }} }
22+
run: gh pr comment ${{ github.event.pull_request.number }} --body-file "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)