From 534ae5e7292e887545425711e8e8abfee1dd59de Mon Sep 17 00:00:00 2001 From: hgosalia Date: Fri, 1 May 2026 22:30:03 -0400 Subject: [PATCH] Updated pr summary yml --- .github/workflows/pr-summary.yml | 52 ++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-summary.yml b/.github/workflows/pr-summary.yml index 259a35a..58b9dab 100644 --- a/.github/workflows/pr-summary.yml +++ b/.github/workflows/pr-summary.yml @@ -7,7 +7,55 @@ on: jobs: summary: runs-on: ubuntu-latest + permissions: + pull-requests: write steps: - - uses: Codium-ai/pr-agent@main + - name: Generate PR Summary + uses: actions/github-script@v7 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + script: | + const prNumber = context.payload.pull_request.number; + + const { data: pr } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + }); + + const { data: commits } = await github.rest.pulls.listCommits({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + }); + + const { data: files } = await github.rest.pulls.listFiles({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + }); + + const summary = `## 📋 PR Summary + + **Title:** ${pr.title} + **Author:** @${pr.user.login} + **State:** ${pr.state.toUpperCase()} + **Draft:** ${pr.draft ? 'Yes' : 'No'} + + ### Changes + - **Commits:** ${commits.length} + - **Files Changed:** ${files.length} + - **Additions:** +${pr.additions} + - **Deletions:** -${pr.deletions} + + ### Files Modified + ${files.slice(0, 10).map(f => `- \`${f.filename}\` (${f.changes} changes)`).join('\n')} + ${files.length > 10 ? `- ... and ${files.length - 10} more files` : ''} + + ${pr.body ? `### Description\n${pr.body}` : ''}`; + + await github.rest.issues.createComment({ + issue_number: prNumber, + owner: context.repo.owner, + repo: context.repo.repo, + body: summary, + });