-
Notifications
You must be signed in to change notification settings - Fork 1.8k
102 lines (98 loc) · 4.1 KB
/
Copy pathchangelog.yml
File metadata and controls
102 lines (98 loc) · 4.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: changelog
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.id }}
cancel-in-progress: true
on:
pull_request:
branches: ["main"]
jobs:
changelog:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check for skip-changelog label
id: skip
shell: bash
env:
SKIP_CHANGELOG: ${{ contains(github.event.pull_request.labels.*.name, 'skip-changelog') }}
run: |
if [ "$SKIP_CHANGELOG" = "true" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "PR has 'skip-changelog' label; bypassing changelog check."
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
# The heading guard runs even for skip-changelog PRs: that label only
# waives the news-fragment requirement, not the publish-trigger guard.
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
# A merged version heading without a git tag triggers a real publish
# (see release_from_changelog.yml), so new headings must come from the
# Dispatch release workflow's release/* branches — not hand edits.
# check-headings uses the same parser the release pipeline publishes
# from, so the guard and the publisher cannot disagree. Escape hatch
# for deliberate restructuring: the 'changelog-version-edit' label.
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
if: ${{ !contains(github.event.pull_request.labels.*.name, 'changelog-version-edit') && !startsWith(github.head_ref, 'release/') }}
- name: Reject manual changelog version headings
if: ${{ !contains(github.event.pull_request.labels.*.name, 'changelog-version-edit') && !startsWith(github.head_ref, 'release/') }}
env:
BASE_REF: origin/${{ github.base_ref }}
run: uv run --no-config --locked --script scripts/release.py check-headings
- uses: ./.github/actions/setup_build_env
if: steps.skip.outputs.skip != 'true'
with:
python-version: "3.14"
run-uv-sync: true
- name: Determine affected packages
if: steps.skip.outputs.skip != 'true'
id: affected
shell: bash
run: |
set -euo pipefail
changed=$(git diff --name-only origin/main...HEAD)
affected=()
if printf '%s\n' "$changed" | grep -qE '^reflex/'; then
affected+=(".")
fi
for pkg_dir in packages/*/; do
pkg=$(basename "$pkg_dir")
case "$pkg" in
integrations-docs|reflex-components-internal|reflex-site-shared) continue ;;
esac
if printf '%s\n' "$changed" | grep -qE "^packages/$pkg/src/"; then
affected+=("${pkg_dir%/}")
fi
done
printf '%s\n' "${affected[@]}" > affected.txt
echo "Affected packages:"
cat affected.txt
- name: Check for news fragments
if: steps.skip.outputs.skip != 'true'
shell: bash
run: |
set -euo pipefail
if [ ! -s affected.txt ]; then
echo "No packaged source changes in this PR; no changelog fragments required."
exit 0
fi
failed=0
while IFS= read -r pkg_dir; do
[ -z "$pkg_dir" ] && continue
echo "::group::towncrier check ($pkg_dir)"
if ! uv run towncrier check --config pyproject.toml --dir "$pkg_dir" --compare-with origin/main; then
failed=1
fi
echo "::endgroup::"
done < affected.txt
if [ "$failed" -ne 0 ]; then
echo ""
echo "One or more affected packages is missing a news fragment under <package>/news/."
echo "Add a fragment named <pr-number>.<type>.md where <type> is one of:"
echo " breaking, deprecation, feature, bugfix, performance, docs, misc"
echo "Or apply the 'skip-changelog' label if the change is genuinely not user-facing."
exit 1
fi