Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Check PR title

on:
merge_group:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
- ready_for_review
- unlocked

jobs:
check-pr-title:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout repo
uses: actions/checkout@v3

- uses: ./.github/actions/setup_repo
- name: Check PR title - commitlint
run: |
PR_NUMBER=$(echo "${{ github.ref }}" | gawk '{match($0, /pr-([0-9]+)-/, arr); print arr[1]}')
PR_NUMBER=${PR_NUMBER:-"${{ github.event.number }}"}

gh pr view $PR_NUMBER --json=title --jq=.title | yarn commitlint

- name: Check PR title - message scope
run: |
PR_NUMBER=$(echo "${{ github.ref }}" | gawk '{match($0, /pr-([0-9]+)-/, arr); print arr[1]}')
PR_NUMBER=${PR_NUMBER:-"${{ github.event.number }}"}

input=$(gh pr view $PR_NUMBER --json=title --jq=.title)

if [[ $input =~ ^fix\\(RNPSW\\):[[:space:]].+ ]]; then
echo "✅ Valid fix PR title"
elif [[ $input =~ ^feat\\(RNPSW\\):[[:space:]].+ ]]; then
echo "✅ Valid feature PR title"
elif [[ $input =~ ^perf\\(RNPSW\\):[[:space:]].+ ]]; then
echo "✅ Valid performance PR title"
elif [[ $input =~ ^BREAKING[[:space:]]CHANGE:[[:space:]].+ ]]; then
echo "✅ Valid breaking change PR title"
else
echo "❌ Invalid PR title format!"
echo "Must start with one of:"
echo " • fix(RNPSW): <desc>"
echo " • feat(RNPSW): <desc>"
echo " • perf(RNPSW): <desc>"
echo " • BREAKING CHANGE: <desc>"
exit 1
fi
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
4 changes: 3 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
# we currently don't lint-staged config in package.json and this file is redundant for now, but we may add more tasks later
# so we keep it for future use. I just added npx to ensure it works on all systems
npx
Binary file added .yarn/install-state.gz
Binary file not shown.
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
8 changes: 8 additions & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
// We can add custom rules here if needed
rules: {
// Example: disallow empty scope
// 'scope-empty': [2, 'never'],
}
};
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@
"build": "rm -rf production && tsc -p .",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"test": "jest",
"semantic-release": "semantic-release"
"semantic-release": "semantic-release",
"prepare": "husky install"
},
"devDependencies": {
"@babel/core": "^7.22.0",
"@babel/runtime": "^7.14.6",
"@commitlint/cli": "^19.8.1",
"@commitlint/config-conventional": "^19.8.1",
"@react-native-community/eslint-config": "^3.0.0",
"@testing-library/jest-native": "^5.4.3",
"@testing-library/react-native": "^13.0.0",
Expand All @@ -44,6 +47,7 @@
"babel-jest": "^26.6.3",
"eslint": "^7.30.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"husky": "^8.0.0",
"jest": "^29.7.0",
"jest-react-native": "^18.0.0",
"metro-react-native-babel-preset": "^0.66.1",
Expand All @@ -69,5 +73,6 @@
"LICENSE",
"package.json",
"contributing.md"
]
}
],
"packageManager": "yarn@1.22.22"
}
2,717 changes: 1,557 additions & 1,160 deletions yarn.lock

Large diffs are not rendered by default.

Loading