Skip to content
This repository was archived by the owner on Aug 31, 2025. It is now read-only.

Commit c567741

Browse files
authored
Add GitHub actions and husky setup (#3)
1 parent 8d0bc0c commit c567741

File tree

9 files changed

+543
-45
lines changed

9 files changed

+543
-45
lines changed

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: 'npm' # See documentation for possible values
9+
directory: '/' # Location of package manifests
10+
schedule:
11+
interval: 'weekly'
12+
commit-message:
13+
prefix: 'chore'
14+
include: 'scope'

.github/pull_request_template.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Description
2+
3+
Describe what was changed in this pull request
4+
5+
## Example images/recordings
6+
7+
Include example images/recordings if the new feature introduces some visual changes
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Lint PR
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
permissions: write-all
11+
12+
jobs:
13+
validate_pr_title:
14+
name: 👌 Validate PR title
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: amannn/action-semantic-pull-request@v5
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
20+
with:
21+
wip: true
22+
23+
- uses: marocchino/sticky-pull-request-comment@v2
24+
# When the previous steps fails, the workflow would stop. By adding this
25+
# condition you can continue the execution with the populated error message.
26+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
27+
with:
28+
header: pr-title-lint-error
29+
message: |
30+
Hey there and thank you for opening this pull request! 👋🏼
31+
32+
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
33+
34+
Details:
35+
36+
```
37+
${{ steps.lint_pr_title.outputs.error_message }}
38+
```
39+
40+
# Delete a previous comment when the issue has been resolved
41+
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
42+
uses: marocchino/sticky-pull-request-comment@v2
43+
with:
44+
header: pr-title-lint-error
45+
delete: true

.github/workflows/rebase.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Automatic Rebase
2+
on:
3+
issue_comment:
4+
types: [created]
5+
jobs:
6+
rebase:
7+
name: 🌿 Rebase
8+
runs-on: ubuntu-latest
9+
if: >-
10+
github.event.issue.pull_request != '' &&
11+
(
12+
contains(github.event.comment.body, '/rebase') ||
13+
contains(github.event.comment.body, '/autosquash')
14+
)
15+
steps:
16+
- name: 🛒 Checkout code
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
token: ${{ secrets.GH_TOKEN }}
21+
22+
- name: 🤖 Automatic Rebase
23+
uses: cirrus-actions/[email protected]
24+
with:
25+
autosquash: ${{ contains(github.event.comment.body, '/autosquash') || contains(github.event.comment.body, '/rebase-autosquash') }}
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

.github/workflows/test.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Typecheck
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
typecheck:
13+
name: 🔎 Typecheck
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: 🛒 Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: ⚙️ Setup Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 18
23+
24+
- name: 📦 Install dependencies
25+
run: yarn install --frozen-lockfile
26+
27+
- name: 🔎 Run typecheck
28+
run: yarn typecheck:all

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn lint-staged

example/package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
{
22
"name": "example",
33
"version": "1.0.0",
4-
"main": "index.ts",
5-
"scripts": {
6-
"start": "expo start",
7-
"android": "expo start --android",
8-
"ios": "expo start --ios",
9-
"web": "expo start --web"
10-
},
114
"dependencies": {
125
"expo": "~49.0.15",
136
"expo-status-bar": "~1.6.0",
@@ -19,5 +12,13 @@
1912
"@types/react": "~18.2.14",
2013
"typescript": "^5.1.3"
2114
},
22-
"private": true
15+
"main": "index.ts",
16+
"private": true,
17+
"scripts": {
18+
"android": "expo start --android",
19+
"ios": "expo start --ios",
20+
"start": "expo start",
21+
"typecheck": "tsc -p tsconfig.json --noEmit",
22+
"web": "expo start --web"
23+
}
2324
}

package.json

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,52 @@
11
{
22
"name": "react-native-skia-responsive-text",
3-
"private": true,
43
"version": "1.0.0",
5-
"main": "index.js",
6-
"repository": "[email protected]:MatiPl01/react-native-skia-responsive-text.git",
74
"author": "Mateusz Łopaciński <[email protected]>",
8-
"license": "MIT",
9-
"publishConfig": {
10-
"access": "public"
11-
},
125
"devDependencies": {
136
"eslint": "^8.52.0",
147
"eslint-config-react-native-matipl01": "^1.0.2",
8+
"husky": "^8.0.0",
159
"jest": "^29.7.0",
10+
"lint-staged": "^15.0.2",
1611
"prettier": "^3.0.3",
1712
"react": "^18.2.0",
1813
"react-native": "^0.72.5",
14+
"syncpack": "^11.2.1",
1915
"typescript": "^5.2.2"
2016
},
17+
"license": "MIT",
18+
"lint-staged": {
19+
"*.{js,jsx,ts,tsx}": [
20+
"yarn lint:fix",
21+
"bash -c tsc --noEmit",
22+
"yarn format:code"
23+
],
24+
"package.json": [
25+
"syncpack format"
26+
]
27+
},
28+
"main": "index.js",
29+
"private": true,
30+
"publishConfig": {
31+
"access": "public"
32+
},
33+
"repository": "[email protected]:MatiPl01/react-native-skia-responsive-text.git",
2134
"resolutions": {
2235
"react": "^18.2.0",
2336
"react-native": "^0.72.5"
2437
},
2538
"scripts": {
2639
"example": "yarn workspace example start",
2740
"example:android": "yarn workspace example android",
28-
"example:ios": "yarn workspace example ios"
41+
"example:ios": "yarn workspace example ios",
42+
"format:code": "prettier --write . --ignore-unknown",
43+
"format:deps": "syncpack format",
44+
"lint": "eslint .",
45+
"lint:fix": "eslint --fix .",
46+
"prepare": "husky install",
47+
"typecheck": "tsc -p tsconfig.json --noEmit",
48+
"typecheck:all": "yarn typecheck && yarn typecheck:example",
49+
"typecheck:example": "yarn workspace example typecheck"
2950
},
3051
"workspaces": [
3152
"example"

0 commit comments

Comments
 (0)