Skip to content

Commit 0370a4c

Browse files
ci: add required checks for PR-only workflow (#1)
* ci: add required checks for PR-only workflow * ci: run title validation on pull_request
1 parent 607a3e8 commit 0370a4c

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

.github/pull_request_template.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Summary
2+
3+
-
4+
5+
## Validation
6+
7+
- [ ] `bun run check`
8+
- [ ] `bun run typecheck`
9+
10+
## Notes
11+
12+
-

.github/workflows/check.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Check
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
Check:
11+
name: Check
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Bun
18+
uses: oven-sh/setup-bun@v2
19+
with:
20+
bun-version: 1.3.8
21+
22+
- name: Install dependencies
23+
run: bun install --frozen-lockfile
24+
25+
- name: Biome check
26+
run: bun run check
27+
28+
- name: TypeScript typecheck
29+
run: bun run typecheck
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: ValidatePrTitle
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize, reopened]
6+
7+
permissions:
8+
pull-requests: read
9+
10+
jobs:
11+
ValidatePrTitle:
12+
name: ValidatePrTitle
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Validate pull request title
16+
env:
17+
PR_TITLE: ${{ github.event.pull_request.title }}
18+
run: |
19+
title="${PR_TITLE}"
20+
if [ -z "${title// /}" ]; then
21+
echo "PR title cannot be empty."
22+
exit 1
23+
fi
24+
25+
if [[ "$title" =~ ^[Ww][Ii][Pp]([:\ ]|$) ]]; then
26+
echo "PR title cannot start with WIP."
27+
exit 1
28+
fi
29+
30+
echo "PR title is valid: $title"

0 commit comments

Comments
 (0)