Skip to content

Commit 5993a1c

Browse files
authored
Merge branch 'main' into julio/versioning/remove-manual-changelog-modifications
2 parents ab5f2a7 + f131aaa commit 5993a1c

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

.github/workflows/pr-metadata-docs-and-deps.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ permissions:
44
pull-requests: read
55
on:
66
pull_request:
7+
types: [opened, synchronize, reopened, labeled, unlabeled]
78
branches-ignore:
89
- "v[0-9]+.[0-9]+.[0-9]+.[0-9]+"
910
- release
@@ -166,6 +167,64 @@ jobs:
166167
body-path: doc-check-results.md
167168
edit-mode: replace
168169

170+
changelog-check:
171+
needs: changed-crates
172+
if: |
173+
needs.changed-crates.outputs.crates_count > 0 &&
174+
!contains(github.event.pull_request.labels.*.name, 'skip-changelog-check')
175+
runs-on: ubuntu-latest
176+
steps:
177+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
178+
with:
179+
fetch-depth: 0 # Need full history for git diff
180+
- name: Check for CHANGELOG.md changes in publishable crates
181+
run: |
182+
# Get the base ref for comparison
183+
BASE_REF='${{ needs.changed-crates.outputs.base_ref }}'
184+
185+
# Get the list of changed crates
186+
CRATES='${{ needs.changed-crates.outputs.crates }}'
187+
188+
FAILED=0
189+
MODIFIED_CHANGELOGS=()
190+
191+
while read -r crate; do
192+
NAME=$(echo "$crate" | jq -r '.name')
193+
CRATE_PATH=$(echo "$crate" | jq -r '.path')
194+
CHANGELOG_PATH="$CRATE_PATH/CHANGELOG.md"
195+
196+
# Check if CHANGELOG.md exists
197+
if [[ ! -f "$CHANGELOG_PATH" ]]; then
198+
# This shouldn't happen, skipping for now.
199+
continue
200+
fi
201+
202+
# Check if CHANGELOG.md has been modified in this PR
203+
if git diff --name-only "$BASE_REF" HEAD | grep -q "^$CHANGELOG_PATH$"; then
204+
MODIFIED_CHANGELOGS+=("$NAME ($CHANGELOG_PATH)")
205+
FAILED=1
206+
fi
207+
done < <(echo "$CRATES" | jq -c '.[]')
208+
209+
if [[ $FAILED -eq 1 ]]; then
210+
echo ""
211+
echo "=========================================="
212+
echo "ERROR: CHANGELOG.md files modified in publishable crates"
213+
echo "=========================================="
214+
echo ""
215+
echo "The following publishable crates have CHANGELOG.md changes:"
216+
for changelog in "${MODIFIED_CHANGELOGS[@]}"; do
217+
echo " - $changelog"
218+
done
219+
echo ""
220+
echo "CHANGELOG.md files should only be updated during the release process."
221+
echo "Please revert the CHANGELOG.md changes from this PR."
222+
exit 1
223+
fi
224+
225+
echo ""
226+
echo "No CHANGELOG.md changes detected in publishable crates"
227+
169228
dependency-check:
170229
needs: changed-crates
171230
if: needs.changed-crates.outputs.crates_count > 0

.github/workflows/pr-title-semver-check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
env:
1313
CARGO_TERM_COLOR: always
14-
RUST_VERSION: stable
14+
RUST_VERSION: 1.92.0
1515

1616
jobs:
1717
detect-changes:
@@ -111,7 +111,7 @@ jobs:
111111
set -euo pipefail
112112
113113
CHANGED_CRATES='${{ needs.detect-changes.outputs.changed_crates }}'
114-
BASELINE="origin/main"
114+
BASELINE="main"
115115
HIGHEST_LEVEL=""
116116
117117
# Parse JSON array

scripts/semver-level.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,14 @@ compute_semver_results() {
5555
# Fetch base commit
5656
git fetch origin "$baseline" --depth=50 --quiet
5757

58+
# Ensure baseline has origin/ prefix if it doesn't already
59+
if [[ ! "$baseline" =~ ^origin/ ]]; then
60+
baseline="origin/$baseline"
61+
fi
62+
5863
log_verbose "========================================" >&2
5964
log_verbose "Checking semver for: $crate" >&2
65+
log_verbose "Using baseline ref: $baseline" >&2
6066
log_verbose "========================================" >&2
6167

6268
LEVEL="none"

0 commit comments

Comments
 (0)