Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
Latest commit
46 lines (40 loc) · 1.59 KB
/
Copy pathpr-description.yml
File metadata and controls
46 lines (40 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Gerar descrição do PR com IA
on:
pull_request:
types: [opened, reopened]
permissions:
contents: read
pull-requests: write
models: read
jobs:
describe:
# Só gera a descrição se o autor não tiver escrito nada.
if: github.event.pull_request.body == '' || github.event.pull_request.body == null
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Gerar diff do PR
run: |
git fetch origin "${{ github.event.pull_request.base.ref }}" --depth=1
git diff "origin/${{ github.event.pull_request.base.ref }}...HEAD" \
-- . ':(exclude)package-lock.json' ':(exclude)*.lock' \
> pr.diff
# Evita estourar o limite de tokens do modelo em PRs muito grandes.
head -c 20000 pr.diff > pr.diff.trunc && mv pr.diff.trunc pr.diff
- name: Gerar descrição com GitHub Models
id: inference
uses: actions/ai-inference@v1
with:
model: openai/gpt-4o-mini
system-prompt: |
Você escreve descrições de Pull Request em português do Brasil, em Markdown,
com base apenas no diff fornecido. Use as seções "## Resumo" e "## Mudanças"
(lista de bullets). Seja direto, sem inventar contexto que não esteja no diff.
prompt-file: pr.diff
- name: Atualizar descrição do PR
env:
GH_TOKEN: ${{ github.token }}
run: gh pr edit "${{ github.event.pull_request.number }}" --body-file "${{ steps.inference.outputs.response-file }}"