-
Notifications
You must be signed in to change notification settings - Fork 6
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
Create bito-actions.sh #31
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
eb10472
Create bito-actions.sh
rishabhbohra-bito 7847f3f
Added sample property file for bito actions
rishabhbohra-bito 65b0c79
BITO-5464 bug-fixes in bito action script
rishabhbohra-bito 9ba26f7
removed the secret log message
rishabhbohra-bito 46929ee
Merge pull request #32 from gitbito/BITO-5464-bug-fixes
rishabhbohra-bito File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/bin/bash | ||
|
||
# Function to read property values from the file | ||
read_property() { | ||
local property_key=$1 | ||
local property_file=$2 | ||
local property_value=$(grep -w "${property_key}" "${property_file}" | cut -d'=' -f2-) | ||
echo "${property_value//\"}" | ||
} | ||
|
||
# Initialize variables with default empty values | ||
agent_instance_url="" | ||
agent_instance_secret="" | ||
git_url="" | ||
|
||
# Check if the first argument is a file | ||
if [ -f "$1" ]; then | ||
PROPERTY_FILE=$1 | ||
shift | ||
|
||
# Read initial values from the property file | ||
agent_instance_url=$(read_property "agent_instance_url" "${PROPERTY_FILE}") | ||
agent_instance_secret=$(read_property "agent_instance_secret" "${PROPERTY_FILE}") | ||
git_url=$(read_property "git_url" "${PROPERTY_FILE}") | ||
fi | ||
|
||
# Override with command line arguments if provided | ||
for arg in "$@" | ||
do | ||
case $arg in | ||
agent_instance_url=*) | ||
agent_instance_url="${arg#*=}" | ||
agent_instance_url="${agent_instance_url//\"}" | ||
;; | ||
agent_instance_secret=*) | ||
agent_instance_secret="${arg#*=}" | ||
agent_instance_secret="${agent_instance_secret//\"}" | ||
;; | ||
git_url=*) | ||
git_url="${arg#*=}" | ||
git_url="${git_url//\"}" | ||
;; | ||
*) | ||
echo "Unknown argument: $arg" | ||
;; | ||
esac | ||
done | ||
|
||
# Check if any of the required properties are empty | ||
if [ -z "$agent_instance_url" ]; then | ||
echo "Error: agent_instance_url is empty" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$agent_instance_secret" ]; then | ||
echo "Error: agent_instance_secret is empty" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$git_url" ]; then | ||
echo "Error: git_url is empty" | ||
exit 1 | ||
fi | ||
|
||
# Print properties | ||
echo "Agent Instance URL: $agent_instance_url" | ||
echo "Git URL: $git_url" | ||
|
||
# Execute the curl command | ||
eval "curl --location '$agent_instance_url' \ | ||
--header 'X-Bito-Action-Token: $agent_instance_secret' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ | ||
\"git_url\": \"$git_url\", | ||
\"command\": \"review\", | ||
\"arguments\": {} | ||
}'" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
agent_instance_url= | ||
agent_instance_secret= | ||
git_url= |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bito Code Review Agent Run #d5dade - 08/08/2024, 05:06 pm
Code suggestion
Is this a valid issue, or was it incorrectly flagged by the Agent?