-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (38 loc) · 1.35 KB
/
changeset-check.yml
File metadata and controls
43 lines (38 loc) · 1.35 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
name: Changeset Check
on:
pull_request:
branches:
- main
- dev
jobs:
changeset-check:
name: Check for changeset
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for changeset files
uses: actions/github-script@v7
with:
script: |
const { data: files } = await github.rest.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
});
const hasChangeset = files.some(f =>
f.filename.startsWith('.changeset/') &&
f.filename.endsWith('.md') &&
f.filename !== '.changeset/README.md'
);
if (!hasChangeset) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: '⚠️ **No changeset found.** If this PR should trigger a release, run `npx changeset` and commit the generated file.\n\nIf this change doesn\'t need a release (docs, CI config, etc.), you can ignore this message.'
});
core.warning('No changeset file found in this PR.');
}