Skip to content

Commit ce87249

Browse files
authored
feat: Lint pr titles (#6770)
* initialize github actions * update linting code * update comment * update wip regex * add link to pr naming guide * cache yarn? * update frozen-lockfile to immutable for yarn 4 * try caching node modules * remove hardened mode, testing to see yarn install time * remove action, use workflow only
1 parent 7a9c220 commit ce87249

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Diff for: .github/workflows/lint-pr-titles.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: PR Title Lint
2+
on:
3+
pull_request:
4+
types: [opened, edited, reopened, synchronize]
5+
permissions:
6+
pull-requests: read
7+
jobs:
8+
pr-title-lint:
9+
runs-on: ubuntu-latest
10+
name: Lint PR Title
11+
steps:
12+
- name: Check PR Title
13+
env:
14+
TITLE: ${{ github.event.pull_request.title}}
15+
run: |
16+
if [[ "${TITLE,,}" =~ ^\[?\(?wip\]?\)? ]]; then
17+
echo "PR is marked as a WIP. Skipping validation."
18+
exit 0
19+
elif (echo "${TITLE,,}" | grep -P "^(fix|feat|build|chore|docs|test|refactor|ci|localize|bump|revert)(\(([A-Za-z0-9])+\))?:"); then
20+
echo "Success"
21+
exit 0
22+
else
23+
echo "PR title validation failed. Please read our PR naming guide on our github wiki to see how to correctly name your PR: https://github.com/adobe/react-spectrum/wiki/Pull-Request-Naming-Guide"
24+
exit 1
25+
fi

0 commit comments

Comments
 (0)