diff --git a/.github/workflows/DEVELOPER_ASSISTANT.yaml b/.github/workflows/DEVELOPER_ASSISTANT.yaml index 3a155f770..f5eab5872 100644 --- a/.github/workflows/DEVELOPER_ASSISTANT.yaml +++ b/.github/workflows/DEVELOPER_ASSISTANT.yaml @@ -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 @@ -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 }} @@ -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 \ No newline at end of file + # CODING_GUIDELINES.C_KERNEL_GUIDELINES: true diff --git a/sample_python_script.py b/sample_python_script.py new file mode 100644 index 000000000..dc1b5cb97 --- /dev/null +++ b/sample_python_script.py @@ -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() \ No newline at end of file