Repository navigation
120 lines (97 loc) · 3.69 KB
/
Copy pathchangeset.yml
File metadata and controls
120 lines (97 loc) · 3.69 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Changeset
on:
pull_request:
types:
- opened
- reopened
- labeled
- unlabeled
- edited
- synchronize
branches:
- main
- next
- release/**
permissions: {}
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.number }}'
cancel-in-progress: true
jobs:
require-changeset:
name: Require Changeset
runs-on: ubuntu-latest
permissions:
contents: read
# Skip opted out PRs, and release PRs
if: |
! contains(github.event.pull_request.labels.*.name, 'skip changelog') &&
! (github.event.pull_request.title == 'chore(release): publish' && github.event.pull_request.user.login == 'github-actions[bot]') &&
! (github.event.pull_request.user.login == 'dependabot[bot]')
steps:
- name: Checkout source code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Install Dependencies
uses: ./.github/actions/install
# Returns exit code 1 when there are changes without changesets attached to them.
# See: https://github.com/changesets/changesets/blob/main/docs/automating-changesets.md#blocking
- name: Run Changesets
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: pnpm changeset status --since "origin/$BASE_REF"
disallow-major-version:
name: Disallow Major Version
runs-on: ubuntu-latest
permissions:
contents: read
# Block major versions only on main, allow on next.
# Skip release & dependabot PRs.
if: |
github.event.pull_request.base.ref == 'main' &&
! (github.event.pull_request.title == 'chore(release): publish' && github.event.pull_request.user.login == 'github-actions[bot]') &&
! (github.event.pull_request.user.login == 'dependabot[bot]')
steps:
- name: Checkout source code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Install Dependencies
uses: ./.github/actions/install
- name: Check for Major Changeset
id: check-major
uses: ./.github/actions/check-major-version
- name: Disallow Major Version
if: steps.check-major.outputs.has-major == 'true'
run: |
echo "Error: Major changesets are not allowed. Did you mean to create a minor or patch changeset instead?"
exit 1
patch-only-on-release-branches:
name: Patch Only On Release Branches
runs-on: ubuntu-latest
permissions:
contents: read
# Hotfix lines (`release/X.Y.x`) only ship patches: a minor bump would collide with a version
# already released from `main`. Skip release & dependabot PRs.
if: |
startsWith(github.event.pull_request.base.ref, 'release/') &&
! (github.event.pull_request.title == 'chore(release): publish' && github.event.pull_request.user.login == 'github-actions[bot]') &&
! (github.event.pull_request.user.login == 'dependabot[bot]')
steps:
- name: Checkout source code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Install Dependencies
uses: ./.github/actions/install
- name: Check for Non-Patch Changeset
id: check-version
uses: ./.github/actions/check-major-version
- name: Disallow Non-Patch Version
if: steps.check-version.outputs.has-non-patch == 'true'
run: |
echo "Error: Release branches only accept patch changesets."
exit 1