-
Notifications
You must be signed in to change notification settings - Fork 1.7k
41 lines (34 loc) · 1.12 KB
/
check-changeset-added.yml
File metadata and controls
41 lines (34 loc) · 1.12 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
# Fails if a PR doesn't have a changeset and is not labeled
# as "no changeset needed"
name: Check that the PR has a changeset
on:
merge_group:
pull_request:
branches:
- main
- v2
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
jobs:
check-if-changeset:
name: Check that PR has a changeset
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v5
- name: Set up the environment
uses: ./.github/actions/setup-env
# We need to fetch the base ref because the pull request check inspects the diff between the head and the base ref
- run: git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF"
- name: Check if merge group is valid
if: github.event_name == 'merge_group'
run: node scripts/validate-merge-group.ts
- name: Check if PR has a changeset
if: github.event_name == 'pull_request'
env:
GITHUB_EVENT_PULL_REQUEST_LABELS: ${{ toJson(github.event.pull_request.labels) }}
run: node scripts/validate-pull-request-changeset.ts