Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing the agent - Adding sample file #597

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 36 additions & 12 deletions .github/workflows/DEVELOPER_ASSISTANT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,44 @@ jobs:
pr_agent_job:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ai-review') && ((contains(github.event.comment.body, '/review') || contains(github.event.comment.body, '/describe') || contains(github.event.comment.body, '/add_docs') || contains(github.event.comment.body, '/update_changelog')) && github.event.comment.user.login != 'nex-maximus' || (github.event_name == 'pull_request' && github.event.pull_request.user.login != 'nex-maximus')) }}
runs-on: ["ubuntu-latest"]
container:
image: 011528261982.dkr.ecr.us-west-2.amazonaws.com/smartdevops:genai-stable
options: --pull always
credentials:
# Make sure to add the AWS access key and secret key to github secrets vault
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Smart Devops PR Agent Action
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2

- name: Login to Amazon ECR Registry
run: |
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 011528261982.dkr.ecr.us-west-2.amazonaws.com

- name: Pull the Docker image from ECR registry
run: docker pull 011528261982.dkr.ecr.us-west-2.amazonaws.com/smartdevops:genai-stable

- name: Smart Devops PR Agent Action
id: pragent
run: |
. /genai_agent/genai_env/bin/activate && /genai_agent/get_pr_agent_details.sh
shell: bash
export GITHUB_ACTION_AUTO_REVIEW="${GITHUB_ACTION.AUTO_REVIEW}"
export GITHUB_ACTION_AUTO_DESCRIBE="${GITHUB_ACTION.AUTO_DESCRIBE}"
export GITHUB_ACTION_UPDATE_TITLE="${GITHUB_ACTION.UPDATE_TITLE}"
docker run --rm \
-e GITHUB_CONTEXT="${GITHUB_CONTEXT}" \
-e GITHUB_ACTION.AUTO_REVIEW="${GITHUB_ACTION_AUTO_REVIEW}" \
-e GITHUB_ACTION.AUTO_DESCRIBE="${GITHUB_ACTION_AUTO_DESCRIBE}" \
-e GITHUB_ACTION.UPDATE_TITLE="${GITHUB_ACTION_UPDATE_TITLE}" \
-e PR_NUMBER="${PR_NUMBER}" \
-e API_KEY="${API_KEY}" \
-e API_BASE="${API_BASE}" \
-e STABLE_API_VERSION="${STABLE_API_VERSION}" \
-e PREVIEW_API_VERSION="${PREVIEW_API_VERSION}" \
-e DEPLOY_NAME="${DEPLOY_NAME}" \
-e PUSH_TOKEN="${PUSH_TOKEN}" \
-e CLIENT_ID="${CLIENT_ID}" \
-e CLIENT_SECRET="${CLIENT_SECRET}" \
011528261982.dkr.ecr.us-west-2.amazonaws.com/smartdevops:genai-stable bash -c "
. /genai_agent/genai_env/bin/activate && /genai_agent/get_pr_agent_details.sh
"
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
GITHUB_ACTION.AUTO_REVIEW: true
Expand All @@ -32,7 +57,6 @@ jobs:
PREVIEW_API_VERSION: ${{ secrets.PREVIEW_API_VERSION }}
DEPLOY_NAME: ${{ secrets.DEPLOY_NAME }}
PUSH_TOKEN: ${{ secrets.PUSH_TOKEN }}
# Below secrets to fetch the auth token for Intel's API gateway
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}

Expand Down Expand Up @@ -73,4 +97,4 @@ jobs:

# Uncomment the line below to consider the ICP and Kernel Coding Guidelines for C Language Code
# CODING_GUIDELINES.C_ICP_GUIDELINES: true
# CODING_GUIDELINES.C_KERNEL_GUIDELINES: true
# CODING_GUIDELINES.C_KERNEL_GUIDELINES: true
18 changes: 18 additions & 0 deletions sample_python_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import math

def calculate_area_of_circle(radius):
"""Calculate the area of a circle given its radius."""
return math.pi * (radius ** 2)

def main():
# Get user input
radius = float(input("Enter the radius of the circle: "))

# Calculate the area
area = calculate_area_of_circle(radius)

# Print the result
print(f"The area of the circle with radius {radius} is {area:.2f}")

if __name__ == "__main__":
main()
Loading