-
-
Notifications
You must be signed in to change notification settings - Fork 117
Feat(rnpsw) add commit title check #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Jokotoye18
wants to merge
6
commits into
just1and0:main
Choose a base branch
from
Jokotoye18:feat(RNPSW)-add-commit-title-check
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
10adc88
chore: add commit lint dependency
Jokotoye18 1bd6c2c
chore: remove redundant husky gitignore
Jokotoye18 27481db
chore: add commitling config
Jokotoye18 6611adf
feat: add check pr title workflow
Jokotoye18 5da5259
feat: add husky commit-msg
Jokotoye18 9a02c6d
chore: add yarn version
Jokotoye18 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| nodeLinker: node-modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'], | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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", | ||
|
|
@@ -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", | ||
|
|
@@ -69,5 +73,6 @@ | |
| "LICENSE", | ||
| "package.json", | ||
| "contributing.md" | ||
| ] | ||
| } | ||
| ], | ||
| "packageManager": "[email protected]" | ||
| } | ||
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jokotoye18 Remember we’re also bumping this to
[email protected]in your other PR…hope that won’t cause any conflicts?https://github.com/just1and0/React-Native-Paystack-WebView/pull/222/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519