Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ jobs:
with:
fetch-depth: 0

- name: Verify CHANGELOG.md was updated
- name: Verify CHANGELOG.md was updated and links this PR
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
if git diff --name-only "$BASE_SHA...$HEAD_SHA" | grep -qx 'CHANGELOG.md'; then
echo "CHANGELOG.md was updated."
Expand All @@ -35,6 +37,27 @@ jobs:
exit 1
fi

added_changelog_lines="$(
git diff --unified=0 "$BASE_SHA...$HEAD_SHA" -- CHANGELOG.md |
awk '
/^@@/ {
in_hunk = 1
next
}
in_hunk && /^\+/ {
print substr($0, 2)
}
'
)"
expected_pr_link="([#$PR_NUMBER]($PR_URL))"
if grep -Fq "$expected_pr_link" <<< "$added_changelog_lines"; then
echo "CHANGELOG.md links to PR #$PR_NUMBER."
else
echo "::error::New CHANGELOG.md content does not link to this PR."
echo "Add $expected_pr_link to the changelog entry, or apply the 'skip-changelog' label."
exit 1
fi

lockfile:
name: uv.lock is up to date
runs-on: ubuntu-latest
Expand Down
Loading