Skip to content

Commit

Permalink
Merge pull request #44 from noosenergy/NOOS-914/ai-pr-review
Browse files Browse the repository at this point in the history
NOOS-914/ai-pr-review
  • Loading branch information
zyassine authored Oct 9, 2024
2 parents 18f2894 + de36bca commit 3da7130
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 10 deletions.
35 changes: 26 additions & 9 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ version: 2.1
# Filters
# ----------------

release-filters: &release-filters
tags:
# Circleci compatible tag pattern
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/
branches:
ignore: /.*/
release_filters: &release_filters
filters:
tags:
# Circleci compatible tag pattern
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/
branches:
ignore: /.*/

filters_non_master_only: &filter_non_master_only
filters:
branches:
ignore: master

# ----------------
# Orbs declaration
Expand Down Expand Up @@ -182,6 +188,14 @@ jobs:
workspace: noos-prod
plan_message: ${CIRCLE_BUILD_URL}

integration_test_github_post_comment:
executor:
name: noos-ci/default
tag: latest
steps:
- checkout
- noos-ci/github_post_comment

# ------------------
# Pipeline workflows
# ------------------
Expand All @@ -196,6 +210,9 @@ workflows:
- integration_test_python_test_package_uv
- integration_test_python_build_wheel_uv
- integration_test_helm_lint_chart
- integration_test_github_post_comment:
context: CODIUM_SHARED
<<: *filter_non_master_only
- integration_test_helm_build_chart:
context: CIRCLECI_SHARED
- integration_test_docker_build_image:
Expand All @@ -210,14 +227,14 @@ workflows:
# Promote dev to prod version based onto a git tag version.
- approve_for_publishing:
type: approval
filters: *release-filters
<<: *release_filters
- orb-tools/pack:
filters: *release-filters
<<: *release_filters
requires: [approve_for_publishing]
- orb-tools/publish:
vcs_type: << pipeline.project.type >>
orb_name: noosenergy/noos-ci
context: CIRCLECI_ORB_SHARED
requires: [orb-tools/pack]
pub_type: production
filters: *release-filters
<<: *release_filters
1 change: 0 additions & 1 deletion .github/workflows/pr_agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ on:
jobs:
trigger_pr_agent:
uses: ./.github/workflows/pr_agent_template.yml
secrets: inherit
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Upgrade native Circle Orbs for AWS, Helm and Slack.
- Upgrade Helm CLI to v3.16.1.

## [0.4.0] - 2024-10-09
### Added
- Add AI PR Agent.
- Add github command to post a comment in a PR.
34 changes: 34 additions & 0 deletions src/commands/github_post_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---

description: Post a comment under a github PR.

parameters:
api_version:
type: string
default: "2022-11-28"
description: Github API version.
comment:
type: string
default: "/review"
description: Comment to post.

steps:
- run:
name: Post comment under PR
command: >-
PR_NUMBER=$(echo "${CIRCLE_PULL_REQUEST}" | awk -F '/' '{print $NF}')
BASE_URL="https://api.github.com/repos/noosenergy/${CIRCLE_PROJECT_REPONAME}"
set -- "$@" -X POST
set -- "$@" -H "Accept: application/vnd.github+json"
set -- "$@" -H "Authorization: Bearer ${GITHUB_TOKEN}"
set -- "$@" -H "X-GitHub-Api-Version: << parameters.api_version >>"
set -- "$@" ${BASE_URL}/issues/${PR_NUMBER}/comments
set -- "$@" -d "{\"body\": \"<< parameters.comment >>\"}"
curl "$@"
28 changes: 28 additions & 0 deletions src/examples/work_with_github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---

description: Post a comment in a github PR.

usage:

version: 2.1

orbs:
noos-ci: noosenergy/[email protected]

jobs:
github_post_comment:
executor:
name: noos-ci/default
tag: latest
steps:
- checkout
- noos-ci/github_post_comment:
comment: This is an example comment

workflows:
build:
jobs:
- github_post_comment:
filters:
branches:
ignore: master

0 comments on commit 3da7130

Please sign in to comment.