Skip to content

Commit

Permalink
Update pr-checks to not falsely detect changes to packages
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Dec 2, 2024
1 parent 4140a34 commit 818a399
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,17 @@ jobs:
# Find packages with changes
while IFS= read -r file; do
dir=$(dirname "$file")
if [[ -f "$workspace_root/$dir/Cargo.toml" ]]; then
package_name=$(grep -m 1 '^name' "$workspace_root/$dir/Cargo.toml" | awk -F\" '{print $2}')
if ! grep -q "CHANGELOG.md" <<< "$(git diff --name-only ${{ github.event.pull_request.base.sha }} HEAD -- $workspace_root/$dir)"; then
affected_packages+=("$package_name")
echo "::error file=$dir/CHANGELOG.md::Package '$package_name' has changes but CHANGELOG.md is not updated."
dir=$(dirname "$file")
if [[ -f "$workspace_root/$dir/Cargo.toml" ]]; then
package_name=$(grep -m 1 '^name' "$workspace_root/$dir/Cargo.toml" | awk -F\" '{print $2}')
if [ -z "$package_name"]; then
continue
fi
if ! grep -q "CHANGELOG.md" <<< "$(git diff --name-only ${{ github.event.pull_request.base.sha }} HEAD -- $workspace_root/$dir)"; then
affected_packages+=("$package_name")
echo "::error file=$dir/CHANGELOG.md::Package '$package_name' has changes but CHANGELOG.md is not updated."
fi
fi
fi
done < changeset.txt
if [[ ${#affected_packages[@]} -gt 0 ]]; then
Expand Down

0 comments on commit 818a399

Please sign in to comment.