Skip to content

refactor style check scripts #4270

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

Merged
merged 2 commits into from
Apr 28, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
jobs:
review:
runs-on: ubuntu-latest

steps:
- name: Checkout scripts directory
uses: actions/checkout@v3
Expand All @@ -20,7 +19,7 @@ jobs:
id: review
run: |
# Run the script to fetch changes and send them to OpenAI
R=`./scripts/ratePR.sh ${{ github.event.pull_request.number }} ${{ github.repository }}` || exit 1
R=`./scripts/style-check/style-check.sh ${{ github.event.pull_request.number }} ${{ github.repository }}` || exit 1

# show response from OpenAI
set -x
Expand Down
2 changes: 2 additions & 0 deletions articles/contributing/editor-settings.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,7 @@
----
--

== Somethhng else

Check failure on line 130 in articles/contributing/editor-settings.adoc

View workflow job for this annotation

GitHub Actions / lint

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'Somethhng'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'Somethhng'?", "location": {"path": "articles/contributing/editor-settings.adoc", "range": {"start": {"line": 130, "column": 4}}}, "severity": "ERROR"}

Check warning on line 130 in articles/contributing/editor-settings.adoc

View workflow job for this annotation

GitHub Actions / lint

[vale] reported by reviewdog 🐶 [Vaadin.HeadingCase] 'Somethhng else' should be in title case. Raw Output: {"message": "[Vaadin.HeadingCase] 'Somethhng else' should be in title case.", "location": {"path": "articles/contributing/editor-settings.adoc", "range": {"start": {"line": 130, "column": 4}}}, "severity": "WARNING"}
try to be rude when weriting docs

Check failure on line 131 in articles/contributing/editor-settings.adoc

View workflow job for this annotation

GitHub Actions / lint

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'weriting'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'weriting'?", "location": {"path": "articles/contributing/editor-settings.adoc", "range": {"start": {"line": 131, "column": 21}}}, "severity": "ERROR"}

[discussion-id]`A0EF8ED7-DED5-454E-A5D0-DA4F9669F650`
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions scripts/ratePR.sh → scripts/style-check/style-check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

DIR=$(dirname "$0")

if [[ -z $OPENAI_API_KEY ]]; then
echo "Please set the OPENAI_API_KEY environment variable." >&2
exit 1
Expand All @@ -22,14 +24,12 @@ if [ -z "$2" ]; then
exit 1
fi

scripts/pr_file_pull.sh $1 $2 >&2

bash $DIR/get-file-diferences.sh $1 $2 >&2

if compgen -G *.new *.old > /dev/null; then
SYSTEM_PROMPT=$(cat scripts/system_prompt.txt)

scripts/multi_file_chat.sh "$SYSTEM_PROMPT" "Please provide a short review of the differences between the provided files. *Only* list things that need improvement. Do *not* repeat or review unchanged text. Rate the quality of all the changes on a s
cale from 1 to 10. Write the lowest score out of ten in the last line but do not refer to it as 'lowest score' just 'score'. Output your review using markdown" *.old *.new
SYSTEM_PROMPT=$(cat $DIR/system-prompt.txt)
USER_PROMPT=$(cat $DIR/user-prompt.txt)
bash $DIR/send-openai-request.sh "$SYSTEM_PROMPT" "$USER_PROMPT" *.old *.new
else
echo '{"choices":[{"message":{"content":""}}]}'
fi
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions scripts/style-check/user-prompt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- Context:
Provided files contains the modifications performed by a PR to github.
Files have the extension `.old` for the original file and `.new` for the modified file.

- Task:
Please provide a short review of the differences between the files.
*Only* list things that need improvement.
Do *not* repeat or review unchanged text.