Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Fix script
Browse files Browse the repository at this point in the history
  • Loading branch information
chevdor committed Sep 8, 2021
1 parent f8ea3d2 commit 94a3dbc
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions scripts/github/extrinsic-ordering-filter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,44 @@
# This script is used in a Github Workflow. It helps filtering out what is interesting
# when comparing metadata and spot what would require a tx version bump.

# shellcheck disable=SC2002
# shellcheck disable=SC2002,SC2086

FILE=$1

function find_index_changes() {
printf "\n## Index changes\n"
RES=$(cat "$FILE" | grep -E -n -i 'idx:\s*([0-9]+)\s*(->)\s*([0-9]+)' | tr -s " ")
# Higlight indexes that were deleted
function find_deletions() {
printf "\n## Deletions\n"
RES=$(cat "$FILE" | grep -n '\[\-\]' | tr -s " ")
if [ "$RES" ]; then
echo "$RES" | awk '{ printf "%s\\n", $0 }'
else
echo "n/a"
fi
}

function find_deletions() {
printf "\n## Deletions\n"
RES=$(cat "$FILE" | grep -n '\[\-\]' | tr -s " ")
# Highlight indexes that have been deleted
function find_index_changes() {
printf "\n## Index changes\n"
RES=$(cat "$FILE" | grep -E -n -i 'idx:\s*([0-9]+)\s*(->)\s*([0-9]+)' | tr -s " ")
if [ "$RES" ]; then
echo "$RES" | awk '{ printf "%s\\n", $0 }'
else
echo "n/a"
fi
}

# Highlight values that decreased
function find_decreases() {
printf "\n## Decreases\n"
OUT=$(cat "$FILE" | grep -E -i -o '([0-9]+)\s*(->)\s*([0-9]+)' | awk '$1 > $3 { printf "%s;", $0 }')
IFS=$';' LIST=("$OUT")
unset RES
for line in "${LIST[@]}"; do
echo "$line"
RES="$RES\n$(cat "$FILE" | grep -E -i -n "$line" | tr -s " ")"
RES="$RES\n$(cat "$FILE" | grep -E -i -n \"$line\" | tr -s " ")"
done

if [ "$RES" ]; then
echo "$RES" | awk '{ printf "%s\\n", $0 }' | sort -u -g
echo "$RES" | awk '{ printf "%s\\n", $0 }' | sort -u -g | uniq
else
echo "n/a"
fi
Expand Down

0 comments on commit 94a3dbc

Please sign in to comment.