Last active
July 1, 2023 23:18
-
-
Save technillogue/2f9e112105090fc0d3b85c4b42a4dfc7 to your computer and use it in GitHub Desktop.
useful for determining if dependencies have changed across releases
This file contains hidden or 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
#!/bin/bash | |
set -o xtrace -o pipefail -o errexit | |
function get_versions { | |
rm /tmp/versions | |
for tag in $(git tag --list); do | |
git checkout "$tag" &>/dev/null | |
if [ -f python/pyproject.toml ]; then | |
file=python/pyproject.toml | |
elif [ -f pyproject.toml ]; then | |
file=pyproject.toml | |
else | |
continue | |
fi | |
hash=$(cat $file | tomlq --sort-keys '.project.dependencies' | sha256sum | head -c 7) | |
jq --null-input --arg tag "$tag" --arg hash "$hash" '{($tag): ($hash)}' >> /tmp/versions | |
done | |
} | |
get_versions | |
jq --slurp add /tmp/versions > /tmp/tag_to_hash | |
jq --slurp 'add | to_entries | group_by(.value)[] | {(.[0].value): [.[] | .key]}' /tmp/versions | jq --slurp add > /tmp/hash_to_tags | |
jq --slurp '{"tag_to_hash": .[0], "hash_to_tags": .[1]}' /tmp/tag_to_hash /tmp/hash_to_tags | tee /tmp/tag_dependency_hashes.json |
This file contains hidden or 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
{ | |
"tag_to_hash": { | |
"v0.6.0": "c03d76d", | |
"v0.6.1": "c03d76d", | |
"v0.7.0": "b7689c3", | |
"v0.7.0-beta1": "813c4f2", | |
"v0.7.0-beta10": "813c4f2", | |
"v0.7.0-beta11": "813c4f2", | |
"v0.7.0-beta12": "813c4f2", | |
"v0.7.0-beta13": "813c4f2", | |
"v0.7.0-beta14": "813c4f2", | |
"v0.7.0-beta15": "813c4f2", | |
"v0.7.0-beta16": "813c4f2", | |
"v0.7.0-beta17": "813c4f2", | |
"v0.7.0-beta18": "b7689c3", | |
"v0.7.0-beta19": "b7689c3", | |
"v0.7.0-beta2": "813c4f2", | |
"v0.7.0-beta3": "813c4f2", | |
"v0.7.0-beta4": "813c4f2", | |
"v0.7.0-beta5": "813c4f2", | |
"v0.7.0-beta6": "813c4f2", | |
"v0.7.0-beta7": "813c4f2", | |
"v0.7.0-beta8": "813c4f2", | |
"v0.7.0-beta9": "813c4f2", | |
"v0.7.1": "b7689c3", | |
"v0.7.2": "b7689c3", | |
"v0.8.0-beta1": "b7689c3", | |
"v0.8.0-beta2": "b7689c3", | |
"v0.8.0-beta3": "6b0c52c", | |
"v0.8.0-beta4": "6b0c52c", | |
"v0.8.0-beta5": "115fd5c", | |
"v0.8.0-beta6": "115fd5c", | |
"v0.8.0-beta7": "115fd5c", | |
"v0.8.0-beta8": "115fd5c" | |
}, | |
"hash_to_tags": { | |
"115fd5c": [ | |
"v0.8.0-beta5", | |
"v0.8.0-beta6", | |
"v0.8.0-beta7", | |
"v0.8.0-beta8" | |
], | |
"6b0c52c": [ | |
"v0.8.0-beta3", | |
"v0.8.0-beta4" | |
], | |
"813c4f2": [ | |
"v0.7.0-beta1", | |
"v0.7.0-beta10", | |
"v0.7.0-beta11", | |
"v0.7.0-beta12", | |
"v0.7.0-beta13", | |
"v0.7.0-beta14", | |
"v0.7.0-beta15", | |
"v0.7.0-beta16", | |
"v0.7.0-beta17", | |
"v0.7.0-beta2", | |
"v0.7.0-beta3", | |
"v0.7.0-beta4", | |
"v0.7.0-beta5", | |
"v0.7.0-beta6", | |
"v0.7.0-beta7", | |
"v0.7.0-beta8", | |
"v0.7.0-beta9" | |
], | |
"b7689c3": [ | |
"v0.7.0", | |
"v0.7.0-beta18", | |
"v0.7.0-beta19", | |
"v0.7.1", | |
"v0.7.2", | |
"v0.8.0-beta1", | |
"v0.8.0-beta2" | |
], | |
"c03d76d": [ | |
"v0.6.0", | |
"v0.6.1" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment