Skip to content

Commit

Permalink
Merge pull request #27 from bemijonathan/fix/added-README.md
Browse files Browse the repository at this point in the history
updated the readme
  • Loading branch information
bemijonathan authored Jan 21, 2024
2 parents 2efc9a6 + 8be690c commit a57dc80
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 31 deletions.
65 changes: 48 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,56 @@
<h2 align="center"> Woot!! </h2>
<h2 align="center">🌟 Woot!! 🌟</h2>
<p align="center">
acceptance criteria checker for PR,
<em>AI-Powered PR Acceptance Criteria Checker 🤖</em>
</p>

## 🥂 Description
it checks the PR description of a task and ticks off the achieved acceptance criteria, does a PR Summarizer designed to help developers, project
maintainers, and teams quickly understand the essence of pull requests. By
generating concise summaries, it aids in faster reviews and ensures that key
changes are not overlooked.
<h3>📖 Description</h3>
<p>
Woot!! is an innovative AI tool 🛠️ designed to streamline PR reviews by ensuring alignment with acceptance criteria. It's perfect for developers, project maintainers, and teams looking for efficient and accurate PR evaluations.
</p>

## 🚀 Key Features:
<h3>🚀 Key Features</h3>
<ul>
<li><strong>Automatic Summarization:</strong> 📝 Uses NLP to extract main points from PR descriptions.</li>
<li><strong>Key Changes Highlight:</strong> 🔍 Identifies significant code changes for focused reviews.</li>
</ul>

-**Automatic Summarization:** Uses natural language processing to extract the
main points from the PR description and compares it with the jira client acceptance criteria.
-**Highlighting Key Changes:** Identifies and highlights significant code
changes, and generates a test script for to test that PR.
<h3>🛠️ Setup and Installation</h3>
<p>
Follow these steps to get Woot!! up and running in your project:
<ol>
<li>Create a <code>.yml</code> file in <code>.github/workflows</code>.</li>
<li>Add the Woot!! action to your workflow.</li>
<li>Configure your GitHub Token, OpenAI Key, and other necessary details.</li>
</ol>
</p>

## 🦄 Benefits:
<h3>💡 How to Use</h3>
<p>
Integrate Woot!! into your GitHub Actions workflow for automated PR checks. Here's an example configuration:

```sh
- name: Run Woot!!
uses: bemijonathan/woot@v1
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
openAIKey: ${{ secrets.OPEN_AI_KEY }}
jiraEmail: ${{ secrets.JIRA_EMAIL }}
jiraApiKey: ${{ secrets.JIRA_API_KEY }}
jiraHost: ${{ secrets.JIRA_HOST }}
```
</p>

- 🏹 **Accuracy:** Ensures that important changes are not missed from the acceptance criteria.
- 🌎 **Collaboration:** Facilitates better communication between developers and
reviewers.
-**Improves Testing:** Generates a test script for the PR.
<h3>🤝 Contributing</h3>
<p>
Contributions are welcome! 🙌 Check out our contributing guidelines for more information.
</p>

<h3>📜 License</h3>
<p>
This project is licensed under the MIT License - see the <a href="LICENSE">LICENSE</a> file for details.
</p>

<h3>📞 Support</h3>
<p>
Need help? Contact us at <a href="mailto:[email protected]">[email protected]</a>.
</p>
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "atropellar"
description: "Langchain summary for PR"
name: "woot"
description: "Woot ai 🚂 "
author: "bemijonathan"

inputs:
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/run.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
getJiraTicket,
getChanges,
SummariseChanges,
postComment
postSummary
} from '../steps'
import * as core from '@actions/core'

Expand Down
29 changes: 26 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import * as github from '@actions/github'
import {
SummariseChanges,
getChanges,
postComment,
postSummary,
getJiraTicket,
Ai
Ai,
postComment
} from './steps'
import dotenv from 'dotenv'
dotenv.config({ path: __dirname + '/.env' })
Expand All @@ -29,11 +30,26 @@ export async function run(): Promise<void> {
})
if (!jiraIssues.length) {
Logger.warn('Could not get jira ticket, exiting')
await postComment(
`
**⚠️ Warning:**
No jira ticket found.
`,
pullRequestNumber
)
return
}
const changes = await getChanges(pullRequestNumber)
if (!changes) {
Logger.warn('Could not get changes, exiting')
await postComment(
`
**⚠️ Warning:**
No git changes found in this pull request.
`,
pullRequestNumber
)

return
}

Expand All @@ -45,14 +61,21 @@ export async function run(): Promise<void> {
)
if (!jiraSummary || !gitSummary) {
Logger.warn('Summary is empty, exiting')
await postComment(
`
**⚠️ Warning:**
No jira ticket found.
`,
pullRequestNumber
)
return
}
const acSummaries = await SummariseChanges.checkedCodeReviewAgainstCriteria(
gitSummary,
jiraSummary,
ai
)
await postComment(pullRequestNumber, acSummaries ?? '', ai)
await postSummary(pullRequestNumber, acSummaries ?? '', ai)
} catch (error) {
core.setFailed((error as Error)?.message as string)
}
Expand Down
25 changes: 17 additions & 8 deletions src/steps/post-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ import { Logger } from '../utils'
import { Ai } from '.'

const SIGNATURE = 'Added by woot! 🚂'
const getGithubContext = () => {
const githubToken =
core.getInput('gitHubToken') || process.env.GITHUB_ACCESS_TOKEN || ''
const octokit = github.getOctokit(githubToken)
const repo = github.context.repo
return { githubToken, octokit, repo }
}

export async function postComment(
export async function postSummary(
pullRequestNumber: number,
summary: string,
ai: Ai
) {
const githubToken =
core.getInput('gitHubToken') || process.env.GITHUB_ACCESS_TOKEN || ''
const octokit = github.getOctokit(githubToken)
const repo = github.context.repo
Logger.log('posted comment', github.context)

const { octokit, repo } = getGithubContext()
const { data: comments } = await octokit.rest.issues.listComments({
...repo,
issue_number: pullRequestNumber
Expand All @@ -35,10 +39,15 @@ export async function postComment(
summary
)} ${SIGNATURE}`
}
const { data } = await octokit.rest.pulls.update({

postComment(comment, pullRequestNumber)
}

export const postComment = async (comment:string, pullRequestNumber:number) => {
const { octokit, repo } = getGithubContext()
await octokit.rest.pulls.update({
...repo,
pull_number: pullRequestNumber,
body: comment
})
Logger.log('posted comment', data.body)
}
}

0 comments on commit a57dc80

Please sign in to comment.