File tree Expand file tree Collapse file tree 5 files changed +63
-0
lines changed Expand file tree Collapse file tree 5 files changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ on : [push]
2
+
3
+ jobs :
4
+ pr_agent_job :
5
+ runs-on : ubuntu-latest
6
+ name : Run pr agent on every pull request
7
+ steps :
8
+ - name : PR Agent action step
9
+ id : pragent
10
+ uses : Codium-ai/pr-agent@feature/github_action
11
+ with :
12
+ openai-key : " TBD: openai key"
13
+
Original file line number Diff line number Diff line change
1
+ FROM python:3.10 as base
2
+
3
+ WORKDIR /app
4
+ ADD requirements.txt .
5
+ RUN pip install -r requirements.txt && rm requirements.txt
6
+ ENV PYTHONPATH=/app
7
+ ADD pr_agent pr_agent
8
+ ADD github_action/entrypoint.sh /
9
+ RUN chmod +x /entrypoint.sh
10
+ ENTRYPOINT ["/entrypoint.sh"]
Original file line number Diff line number Diff line change
1
+ name : ' PR Agent'
2
+ description : ' Summarize, review and suggest improvements for pull requests'
3
+ inputs :
4
+ openai-key : # id of input
5
+ description : ' OpenAI Key'
6
+ required : true
7
+ default : ' '
8
+ runs :
9
+ using : ' docker'
10
+ image : ' Dockerfile.github_action'
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ python /app/pr_agent/servers/github_action_runner.py
Original file line number Diff line number Diff line change
1
+ import json
2
+ import os
3
+
4
+
5
+ def run_action ():
6
+ GITHUB_EVENT_NAME = os .environ .get ('GITHUB_EVENT_NAME' , None )
7
+ if not GITHUB_EVENT_NAME :
8
+ print ("GITHUB_EVENT_NAME not set" )
9
+ return
10
+ GITHUB_EVENT_PATH = os .environ .get ('GITHUB_EVENT_PATH' , None )
11
+ if not GITHUB_EVENT_PATH :
12
+ print ("GITHUB_EVENT_PATH not set" )
13
+ return
14
+ event_payload = json .load (open (GITHUB_EVENT_PATH , 'r' ))
15
+ GITHUB_REPOSITORY = os .environ .get ('GITHUB_REPOSITORY' , None )
16
+ if not GITHUB_REPOSITORY :
17
+ print ("GITHUB_REPOSITORY not set" )
18
+ return
19
+ print (event_payload )
20
+ print (GITHUB_REPOSITORY )
21
+ print (GITHUB_EVENT_NAME )
22
+ print (GITHUB_EVENT_PATH )
23
+ print ("Hello from run_action" )
24
+ RUNNER_DEBUG = os .environ .get ('RUNNER_DEBUG' , None )
25
+ if not RUNNER_DEBUG :
26
+ print ("RUNNER_DEBUG not set" )
27
+ return
28
+ print (RUNNER_DEBUG )
You can’t perform that action at this time.
0 commit comments