From 97f6779c658e2d025b0d459c7865b118d5d76734 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 17 Sep 2026 17:38:15 +0200 Subject: [PATCH] copilot --- .github/workflows/pr_edit_trigger.yaml | 2 +- .github/workflows/pr_release_notes.yaml | 48 +++++++++++-------------- 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/.github/workflows/pr_edit_trigger.yaml b/.github/workflows/pr_edit_trigger.yaml index cb1e5b6b9..96876b4c5 100644 --- a/.github/workflows/pr_edit_trigger.yaml +++ b/.github/workflows/pr_edit_trigger.yaml @@ -159,7 +159,7 @@ jobs: pull-requests: write contents: read issues: write - models: read + copilot-requests: write file-version: needs: diff --git a/.github/workflows/pr_release_notes.yaml b/.github/workflows/pr_release_notes.yaml index 7757519de..52d8d6781 100644 --- a/.github/workflows/pr_release_notes.yaml +++ b/.github/workflows/pr_release_notes.yaml @@ -17,7 +17,7 @@ permissions: pull-requests: write contents: read issues: write - models: read + copilot-requests: write jobs: check-release-notes: @@ -325,38 +325,30 @@ jobs: ].join('\n'); try { - const response = await fetch( - 'https://models.github.ai/inference/chat/completions', + const { execFile } = require('child_process'); + const { promisify } = require('util'); + const execFileAsync = promisify(execFile); + + const { stdout } = await execFileAsync( + 'copilot', + [ + '-p', + prompt, + '-s', + '--no-ask-user', + '--model', + 'gpt-4.1-mini' + ], { - method: 'POST', - headers: { - Authorization: `Bearer ${process.env.GITHUB_TOKEN}`, - 'Content-Type': 'application/json' + env: { + ...process.env, + GITHUB_TOKEN: process.env.GITHUB_TOKEN }, - body: JSON.stringify({ - model: 'openai/gpt-4.1-mini', - messages: [ - { - role: 'system', - content: 'You write concise, technical release notes for scientific detector software.' - }, - { - role: 'user', - content: prompt - } - ], - temperature: 0.2, - max_tokens: 500 - }) + maxBuffer: 1024 * 1024 } ); - if (!response.ok) { - throw new Error(`AI request failed with status ${response.status}`); - } - - const data = await response.json(); - const aiText = data?.choices?.[0]?.message?.content?.trim(); + const aiText = stdout.trim(); if (!aiText) { throw new Error('AI response did not contain message content.');