Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
879ad60
Codebase migration: transitioning pr-review project to open source
daniel-richter Jul 7, 2025
2436065
Add .gitignore file to exclude build artifacts and environment files
daniel-richter Jul 7, 2025
145131b
Codebase migration: transitioning pr-summary project to open source
daniel-richter Jul 7, 2025
c1f114e
Migrate Renovate configuration to the root directory and remove proje…
daniel-richter Jul 7, 2025
e2c744b
Add VSCode settings for code formatting and linting
daniel-richter Jul 7, 2025
e1f8c2b
Add GitHub Actions workflow for code quality checks using ESLint and …
daniel-richter Jul 7, 2025
35fbf19
Fix cache-dependency-path in code quality workflow for ESLint and Pre…
daniel-richter Jul 7, 2025
59fe9f0
(revert blob-reference-or-value branch changes)
daniel-richter Jul 7, 2025
ad56754
Refactor GitHub Actions workflow to use matrix paths for linting and …
daniel-richter Jul 7, 2025
4d2c9f4
Refactor code quality workflow to streamline matrix strategy for lint…
daniel-richter Jul 7, 2025
81a95c0
Add CI/CD workflow for building and releasing artifacts with version …
daniel-richter Jul 7, 2025
baa31b6
Add Git configuration step for user identity in CI/CD workflow
daniel-richter Jul 7, 2025
3d39bb9
Fix release folder structure for build artifacts by separating PR Sum…
daniel-richter Jul 7, 2025
fb1552f
Create release folder structure for build artifacts by adding directo…
daniel-richter Jul 7, 2025
f58fa42
Add model parameter to AI-assisted actions for PR Summary and PR Review
daniel-richter Jul 7, 2025
091d1cd
Remove dependency on @sap-ai-sdk/foundation-models from package.json …
daniel-richter Jul 7, 2025
0c48cf6
Fix indentation for model parameter in AI-assisted actions for PR Sum…
daniel-richter Jul 7, 2025
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
161 changes: 161 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
name: CI/CD

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch: ~

env:
SOURCE_BRANCH: ${{ github.head_ref || github.ref_name }}
RELEASE_BRANCH: "release/${{ github.head_ref || github.ref_name }}"

jobs:
create-release:
name: Build and push artifacts to release branch
runs-on: [ubuntu-latest]
if: ${{ !startsWith(github.head_ref || github.ref_name, 'release/') }}
steps:
- name: Checkout source branch
uses: actions/checkout@v4
with:
ref: ${{ env.SOURCE_BRANCH }}
path: source-folder
- name: Setup Git
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"

- name: Setup Node (PR Summary)
uses: actions/setup-node@v4
with:
node-version-file: source-folder/pr-summary/.node-version
cache: npm
cache-dependency-path: source-folder/pr-summary/package-lock.json
- name: Build (PR Summary)
working-directory: source-folder/pr-summary
run: |
npm install --frozen-lockfile
npm run build
npm prune --omit=dev

- name: Setup Node (PR Review)
uses: actions/setup-node@v4
with:
node-version-file: source-folder/pr-review/.node-version
cache: npm
cache-dependency-path: source-folder/pr-review/package-lock.json
- name: Build (PR Summary)
working-directory: source-folder/pr-review
run: |
npm install --frozen-lockfile
npm run build
npm prune --omit=dev

- name: If necessary, create release branch
working-directory: source-folder
run: |
if ! git fetch origin ${{ env.RELEASE_BRANCH }}; then
git switch --orphan ${{ env.RELEASE_BRANCH }} --discard-changes
git commit --allow-empty -m "Initial commit"
git push origin ${{ env.RELEASE_BRANCH }}
git switch ${{ env.SOURCE_BRANCH }} --discard-changes
fi

- name: Checkout release branch
uses: actions/checkout@v4
with:
ref: ${{ env.RELEASE_BRANCH }}
path: release-folder
fetch-depth: 0
- name: Prepare fresh release branch
working-directory: source-folder
run: |
rm -rf ${{ github.workspace }}/release-folder/*
mkdir ${{ github.workspace }}/release-folder/pr-summary
mkdir ${{ github.workspace }}/release-folder/pr-review
- name: Copy build output from source branch to release branch (PR Summary)
working-directory: source-folder/pr-summary
run: |
cp action.yml dist ${{ github.workspace }}/release-folder/pr-summary --verbose --recursive
- name: Copy build output from source branch to release branch (PR Review)
working-directory: source-folder/pr-review
run: |
cp action.yml dist ${{ github.workspace }}/release-folder/pr-review --verbose --recursive
- name: Commit and push build artifacts
working-directory: release-folder
run: |
git add -A
git commit -m "${{ github.event.number && format('PR-{0}', github.event.number) || join(github.event.commits.*.message, ', ') }}" || true
git push

testing:
name: Execute the AI-assisted action defined in this PR
runs-on: [ubuntu-latest]
needs: create-release
if: ${{ github.ref_name != 'main' }}
steps:
- name: Checkout release branch
uses: actions/checkout@v4
with:
ref: ${{ env.RELEASE_BRANCH }}
- name: Run the AI-assisted action (PR Summary)
uses: ./pr-summary # action.yml is in the pr-summary folder of the release branch
with:
aicore-service-key: ${{ secrets.AICORE_SERVICE_KEY }}
model: gpt-4o
exclude-files: package-lock.json
display-mode: comment-delta
- name: Run the AI-assisted action (PR Summary)
uses: ./pr-review # action.yml is in the pr-review folder of the release branch
with:
aicore-service-key: ${{ secrets.AICORE_SERVICE_KEY }}
model: gpt-4o
exclude-files: package-lock.json
display-mode: review-comment-delta

update-tags:
name: Update semantic version tags
runs-on: [ubuntu-latest]
needs: create-release
if: ${{ github.ref_name == 'main' }}
steps:
- name: Checkout release branch
uses: actions/checkout@v4
with:
ref: ${{ env.RELEASE_BRANCH }}
- name: Create tags for new version
run: |
set -x

: get latest semantic version tag
git fetch --tags
tag_format="^v?([0-9]+)\.([0-9]+)\.([0-9]+)$"
matching_tag_refs=$(git tag --list --sort=-committerdate | grep -E "$tag_format")
tag=$(head -n 1 <<< "$matching_tag_refs")

: stop if current commit is already tagged
[[ $(git rev-parse HEAD) == $(git rev-list -n 1 "$tag") ]] && exit 0

: update the version
[[ $tag =~ $tag_format ]] && major=${BASH_REMATCH[1]} && minor=${BASH_REMATCH[2]} && patch=${BASH_REMATCH[3]}
commit_log=$(git log -1)
commit_subject=$(git log -1 --pretty=%s);
[[ $commit_log == *"[bot]"* ]] && part="patch" || part="minor"
grep -iq "#patch" <<< "$commit_subject" && part="patch"
grep -iq "#minor" <<< "$commit_subject" && part="minor"
grep -iq "#major" <<< "$commit_subject" && part="major"
[[ $part == "major" ]] && major=$((major + 1)) && minor=0 && patch=0
[[ $part == "minor" ]] && minor=$((minor + 1)) && patch=0
[[ $part == "patch" ]] && patch=$((patch + 1))

: create and push a tag with the new semantic version
tag="v$major.$minor.$patch"
git tag -f "$tag"
git push -f origin "$tag"

: create and push a tag with only the major version
tag="v$major"
git tag -f "$tag"
git push -f origin "$tag"
55 changes: 55 additions & 0 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Code Quality

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch: ~

jobs:
# Use ESLint to check for linting errors
lintCheck:
runs-on: [ubuntu-latest]
name: Linter (${{ matrix.path }})
strategy:
fail-fast: false
matrix:
path: [pr-summary, pr-review]
steps:
- name: Checkout source branch
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache-dependency-path: ${{ matrix.path }}/package-lock.json
- run: npm install --frozen-lockfile
working-directory: ${{ matrix.path }}
- name: Run ESLint
run: npm run lint
working-directory: ${{ matrix.path }}

# Use Prettier to check for formatting errors
formatCheck:
runs-on: [ubuntu-latest]
name: Formatter (${{ matrix.path }})
strategy:
fail-fast: false
matrix:
path: [pr-summary, pr-review]
steps:
- name: Checkout source branch
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache-dependency-path: ${{ matrix.path }}/package-lock.json
- run: npm install --frozen-lockfile
working-directory: ${{ matrix.path }}
- name: Run Prettier
run: npm run prettier
working-directory: ${{ matrix.path }}
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Dependency directory
node_modules

# Build directory
dist

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# dotenv environment variables file
.env
.env.test
test-event.json

# OS metadata
.DS_Store
Thumbs.db

# IDE files
.idea
.vscode
!.vscode/settings.json
!.vscode/launch.json
*.code-workspace

# temporarily
*.md
37 changes: 37 additions & 0 deletions .renovaterc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"addLabels": [
"renovate"
],
"configMigration": true,
"automerge": true,
"autoApprove": true,
"extends": [
"config:recommended",
"helpers:pinGitHubActionDigestsToSemver",
":pinDependencies",
":pinDevDependencies"
],
"packageRules": [
{
"groupName": "non-major dependencies",
"matchUpdateTypes": [
"patch",
"minor"
]
},
{
"matchUpdateTypes": [
"major"
],
"enabled": false,
"matchPackageNames": [
"/^@?octokit//",
"/^eslint$/"
]
}
],
"schedule": [
"every weekend"
]
}
17 changes: 17 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"files.insertFinalNewline": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"json.format.keepLines": true,
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.rules.customizations": [{ "rule": "*", "severity": "warn" }]
}
54 changes: 54 additions & 0 deletions pr-review/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
env:
node: true
es6: true

ignorePatterns:
- dist/
- node_modules/

plugins:
- "@typescript-eslint"
- sonarjs
- unicorn

extends:
# Airbnb's ESLint config with TypeScript support
- airbnb
- airbnb-typescript
# ESLint recommended rules
- eslint:recommended
# Linting with Type Information from TypeScript (https://typescript-eslint.io/getting-started/typed-linting)
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/recommended-type-checked
- plugin:@typescript-eslint/stylistic-type-checked
# SonarJS rules to produce Clean Code by detecting bugs and suspicious patterns (https://github.com/SonarSource/eslint-plugin-sonarjs)
- plugin:sonarjs/recommended-legacy
# "More than 100 powerful ESLint rules"
- plugin:unicorn/recommended
# Turns off all rules that are unnecessary or might conflict with Prettier (https://github.com/prettier/eslint-config-prettier)
# (Make sure to put it last, so it gets the chance to override other configs.)
- prettier

parser: "@typescript-eslint/parser" # typescript-eslint
parserOptions:
ecmaVersion: 2023
sourceType: module
project: ./tsconfig.json # typescript-eslint

root: true

rules:
{
"import/extensions": "off",
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
"import/prefer-default-export": "off",
"import/no-default-export": "error",
"unicorn/no-array-for-each": "off",
"unicorn/prefer-string-replace-all": "off",
"unicorn/prevent-abbreviations": "off",
"no-plusplus": "off",
"no-param-reassign": ["error", { "props": false }],
"unicorn/no-negated-condition": "off",
"@typescript-eslint/no-use-before-define": "off",
}
1 change: 1 addition & 0 deletions pr-review/.node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.17.0
11 changes: 11 additions & 0 deletions pr-review/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"arrowParens": "avoid",
"endOfLine": "lf",
"printWidth": 170,
"quoteProps": "consistent",
"semi": false,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
Loading
Loading