Skip to content

Commit 4a6274b

Browse files
committed
Messing around w/ ai-inference action
1 parent 67448f4 commit 4a6274b

1 file changed

Lines changed: 29 additions & 8 deletions

File tree

.github/workflows/main.yaml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,36 @@ on:
44
- main
55

66
jobs:
7-
hello_world_job:
8-
name: A job to say hello
7+
codoc:
8+
name: Codoc
99
runs-on: ubuntu-latest
10+
if: github.event.pull_request.draft == false
1011

1112
steps:
12-
- name: Hello world action step
13-
id: inference
14-
uses: tylerkoon/codoc@v0.0.3
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
1518

16-
# Use the output from the `hello` step
17-
- name: Get the output time
18-
run: echo "${{ steps.inference.outputs.response }}"
19+
- name: Build prompt input
20+
id: build_prompt
21+
run: |
22+
echo "List the documentation files that exist in the target branch of this PR, and determine if it needs to be updated based on the following pull request diff:" > prompt_input.txt
23+
git fetch origin ${{ github.event.pull_request.base.ref }}
24+
git diff origin/${{ github.event.pull_request.base.ref }}...HEAD >> prompt_input.txt
25+
echo "::notice file=pr_diff.txt::Prompt input generated"
26+
27+
- name: Assess documentation state
28+
id: inference
29+
uses: actions/ai-inference@v2
30+
with:
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
model: gpt-4o
33+
system-prompt: |
34+
You are Codoc, an AI tool that runs in a GitHub Action whose main purpose is to help keep documentation up to date within a repository. You will be provided with a diff of code changes in a pull request. Your task is to analyze the changes and determine if any documentation files (e.g., README.md, docs/) need to be updated to reflect the new code changes. If updates are needed, you will simply tell the user that the documentation should be updated and give a brief justification. You **will not** provide suggestions unless specifically asked.
35+
prompt-file: ./prompt_input.txt
36+
37+
- name: Print Output
38+
id: output
39+
run: echo "${{ steps.inference.outputs.response }}"

0 commit comments

Comments
 (0)