Repository navigation
49 lines (42 loc) · 1.64 KB
/
Copy pathchangeset.yml
File metadata and controls
49 lines (42 loc) · 1.64 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
name: Changeset
# Validate .changeset files on every commit of every PR, with the same rules
# the Package Release workflow applies when it bumps versions. The reminder for
# PRs without a changeset lives in changeset-reminder.yml; keeping it separate
# means this workflow never reports a skipped "Validate changesets" check that
# could satisfy a required status check.
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
jobs:
validate:
name: Validate changesets
# renovate/* PRs are dependency/security updates and never carry changesets
if: "!startsWith(github.event.pull_request.head.ref, 'renovate/')"
runs-on: ubuntu-latest
steps:
# Default ref is the PR merge commit, i.e. the base branch's versions plus
# every changeset that would be pending once this PR merges.
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: "3.10"
- name: Install dependencies
run: pip install click packaging
- name: Validate changesets
env:
BASE_BRANCH: ${{ github.base_ref }}
run: |
# Only RC releases are allowed from non-main branches
args=()
if [ "$BASE_BRANCH" != "main" ]; then
args+=(--rc-only)
fi
if ! out=$(python .github/changesets.py --check "${args[@]}" 2>&1); then
echo "$out"
echo "::error title=Invalid changeset::${out#Error: }"
exit 1
fi
echo "$out"