Skip to content

Commit 84af322

Browse files
authored
ci: Create script to list unreleased commits for each package (#1878)
1 parent 7a81472 commit 84af322

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

scripts/list-unreleased-commits.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
PACKAGES_DIR="./packages"
6+
export GIT_PAGER=cat
7+
IGNORED_DIRS=("browser" "wxt-demo")
8+
9+
if [ ! -d "$PACKAGES_DIR" ]; then
10+
echo "Error: Directory '$PACKAGES_DIR' not found."
11+
exit 1
12+
fi
13+
14+
echo "Checking for changes in packages since their last tag..."
15+
echo ""
16+
17+
for dir in "$PACKAGES_DIR"/*; do
18+
if [ -d "$dir" ]; then
19+
pkg_name=$(basename "$dir")
20+
21+
# Check if the package name is in the ignored directories list
22+
if [[ " ${IGNORED_DIRS[*]} " =~ " $pkg_name " ]]; then
23+
echo "Skipping ignored package: $pkg_name"
24+
continue # Skip to the next directory
25+
fi
26+
27+
echo "----------------------------------------"
28+
echo "Package: $pkg_name"
29+
30+
# Find the latest tag for the package, e.g., "my-package-v1.2.3"
31+
# Sorts tags by version and picks the most recent one.
32+
last_tag=$(git tag --list "${pkg_name}-v*" --sort=-v:refname | head -n 1)
33+
34+
if [ -n "$last_tag" ]; then
35+
# If a tag is found, show commits since that tag for the specific package directory
36+
echo "Commits since last tag ($last_tag):"
37+
git log "${last_tag}..HEAD" --oneline -- "$dir"
38+
else
39+
# If no tag is found, show all commits for that package directory
40+
echo "No tags found for this package. Listing all commits:"
41+
git log --oneline -- "$dir"
42+
fi
43+
echo ""
44+
fi
45+
done

0 commit comments

Comments
 (0)