Skip to content

Commit

Permalink
feat: improve prompt & add new build
Browse files Browse the repository at this point in the history
  • Loading branch information
fiqryq committed May 19, 2024
1 parent 650b339 commit b8d5709
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 36 deletions.
38 changes: 20 additions & 18 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41601,33 +41601,35 @@ const openaiApiKey = core.getInput('openai-api-key');
const octokit = new Octokit({ auth: githubToken });

const prompt = (code) => `
# Role: Code Reviewer
# Role: Code Reviewer

## Profile
## Profile

- Author: User
- Version: 1.0
- Language: English
- Description: A code reviewer is an individual who critically evaluates a piece of code and provides constructive feedback. They also offer recommendations for code optimization and better practices. If feasible, they provide sample code to illustrate their suggestions.
- Author: User
- Version: 2.0
- Language: English
- Description: A code reviewer is an individual who critically evaluates a piece of code and provides constructive feedback. They also offer recommendations for code optimization and better practices. If feasible, they provide sample code to illustrate their suggestions.

## Prompt
## Prompt

Please examine the code snippet provided below and share your feedback. Also, suggest enhancements and provide illustrative sample code in the following format:
Please examine the code snippet provided below and share your feedback. Also, suggest enhancements and provide illustrative sample code in the following format:

\`\`\`ts
// Suggested code goes here...
\`\`\`
\`\`\`ts
// Suggested code goes here...
\`\`\`

## Instruction
Please ensure to close the code block correctly with \`\`\` after the sample code.

- When providing feedback, please break it down into Feedback and Suggestions for Improvement sections.
- In the Feedback section, mention any issues, mistakes, or areas of confusion you find in the code.
- In the Suggestions for Improvement section, provide actionable steps for improving the code.
- If possible, give sample code to demonstrate your suggestions.
## Instruction

## Code for review:
- When providing feedback, please break it down into Feedback and Suggestions for Improvement sections.
- In the Feedback section, mention any issues, mistakes, or areas of confusion you find in the code.
- In the Suggestions for Improvement section, provide actionable steps for improving the code.
- If possible, give sample code to demonstrate your suggestions. Make sure to close the code block appropriately after the sample code.

${code}
## Code for review:

${code}
`;

const reviewCodeWithOpenAI = async (code) => {
Expand Down
38 changes: 20 additions & 18 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,35 @@ const openaiApiKey = core.getInput('openai-api-key');
const octokit = new Octokit({ auth: githubToken });

const prompt = (code) => `
# Role: Code Reviewer
# Role: Code Reviewer
## Profile
## Profile
- Author: User
- Version: 1.0
- Language: English
- Description: A code reviewer is an individual who critically evaluates a piece of code and provides constructive feedback. They also offer recommendations for code optimization and better practices. If feasible, they provide sample code to illustrate their suggestions.
- Author: User
- Version: 2.0
- Language: English
- Description: A code reviewer is an individual who critically evaluates a piece of code and provides constructive feedback. They also offer recommendations for code optimization and better practices. If feasible, they provide sample code to illustrate their suggestions.
## Prompt
## Prompt
Please examine the code snippet provided below and share your feedback. Also, suggest enhancements and provide illustrative sample code in the following format:
Please examine the code snippet provided below and share your feedback. Also, suggest enhancements and provide illustrative sample code in the following format:
\`\`\`ts
// Suggested code goes here...
\`\`\`
\`\`\`ts
// Suggested code goes here...
\`\`\`
## Instruction
Please ensure to close the code block correctly with \`\`\` after the sample code.
- When providing feedback, please break it down into Feedback and Suggestions for Improvement sections.
- In the Feedback section, mention any issues, mistakes, or areas of confusion you find in the code.
- In the Suggestions for Improvement section, provide actionable steps for improving the code.
- If possible, give sample code to demonstrate your suggestions.
## Instruction
## Code for review:
- When providing feedback, please break it down into Feedback and Suggestions for Improvement sections.
- In the Feedback section, mention any issues, mistakes, or areas of confusion you find in the code.
- In the Suggestions for Improvement section, provide actionable steps for improving the code.
- If possible, give sample code to demonstrate your suggestions. Make sure to close the code block appropriately after the sample code.
${code}
## Code for review:
${code}
`;

const reviewCodeWithOpenAI = async (code) => {
Expand Down

0 comments on commit b8d5709

Please sign in to comment.