From 1de004ba0df7763bae4f18fe0e3aec06094e9777 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Mar 2026 17:41:09 +0000 Subject: [PATCH 1/2] Initial plan From e418f8ce2727ced5a8bdde2cb06c7feef143ade9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Mar 2026 17:45:13 +0000 Subject: [PATCH 2/2] fix: replace GitHub Models API with Copilot CLI for AI PR summary Co-authored-by: BayanBennett <16971062+BayanBennett@users.noreply.github.com> Agent-Logs-Url: https://github.com/webmonitoring/.github/sessions/2bd649b3-20eb-4a46-8457-e7a640aee0cf --- .github/workflows/ai-pr-summary.yml | 63 +++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/ai-pr-summary.yml diff --git a/.github/workflows/ai-pr-summary.yml b/.github/workflows/ai-pr-summary.yml new file mode 100644 index 0000000..ee2cc34 --- /dev/null +++ b/.github/workflows/ai-pr-summary.yml @@ -0,0 +1,63 @@ +name: AI PR Summary + +on: + workflow_call: + inputs: + pr_number: + description: Pull request number to summarize + required: true + type: number + secrets: + COPILOT_TOKEN: + description: > + A personal access token (PAT) with the "Copilot Requests" permission, + used to authenticate GitHub Copilot CLI. + required: true + +permissions: + contents: read + pull-requests: write + +jobs: + ai-summary: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Copilot CLI + run: npm install -g @github/copilot + + - name: Generate AI PR summary and comment + env: + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_TOKEN }} + GH_TOKEN: ${{ github.token }} + PR_NUMBER: ${{ inputs.pr_number }} + run: | + gh pr diff "$PR_NUMBER" > pr.diff + if [ ! -s pr.diff ]; then + echo "PR diff is empty or could not be fetched." >&2 + exit 1 + fi + + copilot -p "Read the file pr.diff and write a concise markdown summary of the pull request changes. Focus on what was changed, why it matters, and any notable implementation details. Write the summary to summary.md" \ + --allow-tool='read' \ + --allow-tool='write' \ + --no-ask-user + + if [ ! -s summary.md ]; then + echo "summary.md was not created or is empty." >&2 + exit 1 + fi + + gh pr comment "$PR_NUMBER" \ + --body "## AI Summary + +$(cat summary.md)"