Skip to content

Commit

Permalink
check modified or deleted nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushi-agrawal-gladstone committed Sep 20, 2024
1 parent d91d59b commit 9ec2676
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions .github/workflows/1_on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -878,14 +878,38 @@ jobs:
diff_output=$(cat diff_output.txt)
# Extract nodes that were removed from the GPML file (lines starting with '-')
deleted_nodes=$(echo "$diff_output" | grep "^-" | grep '<DataNode')
deleted_nodes=$(echo "$diff_output" | grep "^-" | grep '<DataNode' | sed 's/^-//')
# Extract nodes that were added or changed in the GPML file (lines starting with '+')
added_or_modified_nodes=$(echo "$diff_output" | grep "^+" | grep '<DataNode' | sed 's/^+//')
# Check for matching GraphId in both deleted and added/modified nodes to determine if it was modified
modified_nodes=""
for deleted_node in $deleted_nodes; do
graph_id=$(echo "$deleted_node" | grep -o 'GraphId="[^"]*"' | sed 's/GraphId="//;s/"//')
if echo "$added_or_modified_nodes" | grep -q "GraphId=\"$graph_id\""; then
modified_nodes="$modified_nodes\n$deleted_node"
fi
done
if [ -z "$deleted_nodes" ]; then
echo "No nodes were deleted."
# Remove modified nodes from the deleted nodes list
actual_deleted_nodes=$(echo "$deleted_nodes" | grep -v -f <(echo "$modified_nodes"))

# Output the results
if [ -z "$actual_deleted_nodes" ] && [ -z "$modified_nodes" ]; then
echo "No nodes were deleted or modified."
else
echo "Deleted nodes:"
echo "$deleted_nodes"
echo "Note: Review required for deleted nodes."
if [ -n "$actual_deleted_nodes" ]; then
echo "Deleted nodes:"
echo "$actual_deleted_nodes"
echo "Note: Review required for deleted nodes."
fi

if [ -n "$modified_nodes" ]; then
echo "Modified nodes:"
echo "$modified_nodes"
echo "Note: Review required for modified nodes."
fi
fi

# Store the deleted nodes as an environment variable for later use
Expand Down

0 comments on commit 9ec2676

Please sign in to comment.