|
1 |
| -# OpenAI Summarize Diff Action |
| 1 | +# openai summarize diff action |
| 2 | +[](https://github.com/captradeoff/openai-summarize-diff-action/actions/workflows/node.js.yml) |
| 3 | + |
2 | 4 |
|
3 |
| -This GitHub Action receives a git diff (e.g., a PR diff) and uses OpenAI to summarize and explain the changes made in that diff in a clear, concise way. |
| 5 | +this github action receives a git diff (e.g., a pr diff) and uses openai to summarize and explain the changes made in that diff in a clear, concise way. |
4 | 6 |
|
5 |
| -## Features |
| 7 | +## features |
6 | 8 |
|
7 |
| -- Generates concise explanations of code changes |
8 |
| -- Customizable output length and style |
9 |
| -- Easy to integrate into your CI/CD workflow |
10 |
| -- Now includes comprehensive tests and error handling |
| 9 | +- generates concise explanations of code changes |
| 10 | +- customizable output length and style |
| 11 | +- easy to integrate into your ci/cd workflow |
| 12 | +- now includes comprehensive tests and error handling |
11 | 13 |
|
12 |
| -## Inputs |
| 14 | +## inputs |
13 | 15 |
|
14 | 16 | ### `diff`
|
15 | 17 |
|
16 |
| -**Required** The diff to be explained. |
| 18 | +**required** the diff to be explained. |
17 | 19 |
|
18 | 20 | ### `apikey`
|
19 | 21 |
|
20 |
| -**Required** Your OpenAI API key. Get one at [OpenAI Platform](https://platform.openai.com/api-keys). |
| 22 | +**required** your openai api key. get one at [openai platform](https://platform.openai.com/api-keys). |
21 | 23 |
|
22 |
| -### `examplePostSummary` |
| 24 | +### `examplepostsummary` |
23 | 25 |
|
24 |
| -**Optional** An example summary to guide the model's output style. |
25 |
| -Default: "update the code with new features: parallelisation, caching, and better error handling" |
| 26 | +**optional** an example summary to guide the model's output style. |
| 27 | +default: "update the code with new features: parallelisation, caching, and better error handling" |
26 | 28 |
|
27 |
| -### `maxTokens` |
| 29 | +### `maxtokens` |
28 | 30 |
|
29 |
| -**Optional** Maximum number of tokens to generate. Default: `30` |
| 31 | +**optional** maximum number of tokens to generate. default: `30` |
30 | 32 |
|
31 |
| -### `maxCharacters` |
| 33 | +### `maxcharacters` |
32 | 34 |
|
33 |
| -**Optional** Maximum characters in the generated explanation. Default: `140` |
| 35 | +**optional** maximum characters in the generated explanation. default: `140` |
34 | 36 |
|
35 |
| -## Outputs |
| 37 | +## outputs |
36 | 38 |
|
37 | 39 | ### `explanation`
|
38 | 40 |
|
39 |
| -The explanation and summary of the diff generated by OpenAI. |
| 41 | +the explanation and summary of the diff generated by openai. |
40 | 42 |
|
41 |
| -## Example usage |
| 43 | +## example usage |
42 | 44 |
|
43 |
| -### To explain the changes made in a PR |
| 45 | +### to explain the changes made in a pr |
44 | 46 |
|
45 | 47 | ```yaml
|
46 | 48 | name: Explain PR Changes
|
|
78 | 80 | run: echo "${{ steps.explain.outputs.explanation }}"
|
79 | 81 | ```
|
80 | 82 |
|
81 |
| -### To explain the changes and post the result as a comment in the PR |
| 83 | +### to explain the changes and post the result as a comment in the pr |
82 | 84 |
|
83 | 85 | ```yaml
|
84 | 86 | name: Explain PR Changes and Comment
|
@@ -130,62 +132,62 @@ jobs:
|
130 | 132 | EXPLANATION: ${{ steps.explain.outputs.explanation }}
|
131 | 133 | ```
|
132 | 134 |
|
133 |
| -## Local Development |
| 135 | +## local development |
134 | 136 |
|
135 |
| -### Setup |
| 137 | +### setup |
136 | 138 |
|
137 |
| -1. Clone the repository: |
| 139 | +1. clone the repository: |
138 | 140 | ```bash
|
139 | 141 | git clone https://github.com/your-username/openai-summarize-diff-action.git
|
140 | 142 | cd openai-summarize-diff-action
|
141 | 143 | ```
|
142 | 144 |
|
143 |
| -2. Install dependencies: |
| 145 | +2. install dependencies: |
144 | 146 | ```bash
|
145 | 147 | npm install
|
146 | 148 | ```
|
147 | 149 |
|
148 |
| -3. Create a `.env` file with your OpenAI API key: |
| 150 | +3. create a `.env` file with your openai api key: |
149 | 151 | ```
|
150 | 152 | OPENAI_API_KEY=your_api_key_here
|
151 | 153 | ```
|
152 | 154 |
|
153 |
| -### Testing |
| 155 | +### testing |
154 | 156 |
|
155 |
| -Run tests: |
| 157 | +run tests: |
156 | 158 | ```bash
|
157 | 159 | npm test
|
158 | 160 | ```
|
159 | 161 |
|
160 |
| -Run tests with coverage: |
| 162 | +run tests with coverage: |
161 | 163 | ```bash
|
162 | 164 | npm run test:coverage
|
163 | 165 | ```
|
164 | 166 |
|
165 |
| -Run tests in watch mode (useful during development): |
| 167 | +run tests in watch mode (useful during development): |
166 | 168 | ```bash
|
167 | 169 | npm run test:watch
|
168 | 170 | ```
|
169 | 171 |
|
170 |
| -### Linting |
| 172 | +### linting |
171 | 173 |
|
172 |
| -Run linting: |
| 174 | +run linting: |
173 | 175 | ```bash
|
174 | 176 | npm run lint
|
175 | 177 | ```
|
176 | 178 |
|
177 |
| -### Building |
| 179 | +### building |
178 | 180 |
|
179 |
| -Build the action: |
| 181 | +build the action: |
180 | 182 | ```bash
|
181 | 183 | npm run build
|
182 | 184 | ```
|
183 | 185 |
|
184 |
| -This will run linting, tests, and then build the action into the `dist` directory. |
| 186 | +this will run linting, tests, and then build the action into the `dist` directory. |
185 | 187 |
|
186 |
| -### Manual Testing |
| 188 | +### manual testing |
187 | 189 |
|
188 |
| -You can test the action locally by creating a test script: |
| 190 | +you can test the action locally by creating a test script: |
189 | 191 |
|
190 | 192 | ```javascript
|
191 | 193 | // test-local.js
|
@@ -219,17 +221,17 @@ index 123..456 789
|
219 | 221 | test();
|
220 | 222 | ```
|
221 | 223 |
|
222 |
| -Run the test script: |
| 224 | +run the test script: |
223 | 225 | ```bash
|
224 | 226 | node test-local.js
|
225 | 227 | ```
|
226 | 228 |
|
227 |
| -## Notes |
| 229 | +## notes |
228 | 230 |
|
229 |
| -- This action uses OpenAI's GPT-4o-mini model by default. |
230 |
| -- Make sure to store your OpenAI API key as a secret in your repository settings. |
231 |
| -- The action will ignore library folders to focus on meaningful code changes. |
| 231 | +- this action uses openai's gpt-4o-mini model by default. |
| 232 | +- make sure to store your openai api key as a secret in your repository settings. |
| 233 | +- the action will ignore library folders to focus on meaningful code changes. |
232 | 234 |
|
233 |
| -## License |
| 235 | +## license |
234 | 236 |
|
235 |
| -ISC |
| 237 | +[mit](https://github.com/captradeoff/openai-summarize-diff-action/blob/main/LICENSE) |
0 commit comments