-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (41 loc) · 1.54 KB
/
pr_content_writer.yml
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
47
name: Automatic PR Content Generator
on:
workflow_dispatch:
inputs:
runWorkflow:
description: 'Manually trigger this workflow?'
required: true
default: 'yes'
pull_request:
types: [opened, reopened]
paths-ignore:
- '.github/workflows/**'
jobs:
prepare_and_generate_content:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.runWorkflow == 'yes')
steps:
- name: Checkout code
uses: actions/checkout@v4 # Updated from v2 to v4 to support Node.js 20
- name: Set up Python
uses: actions/setup-python@v4 # Updated from v2 to v4 to support Node.js 20
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: Generate PR content
id: generate_content
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: python .github/scripts/generate_pr_content.py
- name: Update PR
uses: peter-evans/create-pull-request@v5 # Updated from v3 to v5 for compatibility with newer Node.js versions
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update pull request content
title: 'Automatically Generated PR Summary'
body: ${{ steps.generate_content.outputs.pr_content }}
branch: 'auto-pr-content-branch'