Skip to content

Commit f130b40

Browse files
Add Renovate and Prettier configurations and CI script (#143)
* Update CI. Add Prettier and Renovate configuration files and respective scripts
1 parent ac3e5c1 commit f130b40

File tree

9 files changed

+2031
-1516
lines changed

9 files changed

+2031
-1516
lines changed

.github/renovate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"description": "Check the readme: https://github.com/sanity-io/renovate-presets/blob/main/ecosystem/README.md",
2+
"description": "Check the readme: https://github.com/sanity-io/renovate-config/blob/main/README.md",
33
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
44
"extends": ["github>sanity-io/renovate-config:starter-template"]
55
}

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, feat/ci-renovate-prettier]
6+
pull_request:
7+
branches: [main, feat/ci-renovate-prettier]
8+
workflow_dispatch:
9+
10+
jobs:
11+
run:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
16+
with:
17+
cache: npm
18+
node-version: lts/*
19+
- run: npm install
20+
- run: npm run lint
21+
- run: npm run type-check

.github/workflows/prettier.yml

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
---
21
name: Prettier
32

43
on:
54
push:
6-
branches: [main]
5+
branches: [main, feat/ci-renovate-prettier]
76
workflow_dispatch:
87

98
concurrency:
@@ -15,31 +14,28 @@ jobs:
1514
name: Can the code be prettier? 🤔
1615
runs-on: ubuntu-latest
1716
# workflow_dispatch always lets you select the branch ref, even though in this case we only ever want to run the action on `main` this we need an if check
18-
if: ${{ github.ref_name == 'main' }}
1917
steps:
20-
- uses: actions/checkout@v4
21-
- uses: actions/setup-node@v4
22-
with:
23-
cache: npm
24-
node-version: lts/*
25-
- run: npm ci --ignore-scripts --only-dev
26-
- uses: actions/cache@v3
27-
with:
28-
path: node_modules/.cache/prettier/.prettier-cache
29-
key: prettier-${{ hashFiles('package-lock.json') }}-${{ hashFiles('.gitignore') }}
30-
- run: npx prettier --ignore-path .gitignore --cache --write .
31-
- run: git restore .github/workflows
32-
- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2
33-
id: generate-token
34-
with:
35-
app_id: ${{ secrets.ECOSPARK_APP_ID }}
36-
private_key: ${{ secrets.ECOSPARK_APP_PRIVATE_KEY }}
37-
- uses: peter-evans/create-pull-request@b1ddad2c994a25fbc81a28b3ec0e368bb2021c50 # v6
38-
with:
39-
author: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
40-
body: I ran `npx prettier --ignore-path .gitignore --cache --write .` 🧑‍💻
41-
branch: actions/prettier-if-needed
42-
commit-message: 'chore(prettier): 🤖 ✨'
43-
labels: 🤖 bot
44-
title: 'chore(prettier): 🤖 ✨'
45-
token: ${{ steps.generate-token.outputs.token }}
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
cache: npm
23+
node-version: lts/*
24+
25+
- run: npm install
26+
- run: npm run format
27+
28+
- uses: actions/create-github-app-token@v1
29+
id: generate-token
30+
with:
31+
app-id: ${{ secrets.ECOSPARK_APP_ID }}
32+
private-key: ${{ secrets.ECOSPARK_APP_PRIVATE_KEY }}
33+
- uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7
34+
with:
35+
body: I ran `pnpm format` 🧑‍💻
36+
branch: actions/prettier
37+
commit-message: "chore(prettier): 🤖 ✨"
38+
labels: 🤖 bot
39+
sign-commits: true
40+
title: "chore(prettier): 🤖 ✨"
41+
token: ${{ steps.generate-token.outputs.token }}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.github/**

frontend/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
"name": "frontend",
33
"private": true,
44
"scripts": {
5-
"predev": "npm run typegen",
6-
"dev": "next dev --turbopack",
75
"prebuild": "npm run typegen",
86
"build": "next build",
9-
"start": "next start",
7+
"predev": "npm run typegen",
8+
"dev": "next dev --turbopack",
109
"lint": "next lint",
10+
"start": "next start",
11+
"type-check": "tsc --noEmit",
1112
"typegen": "sanity typegen generate"
1213
},
1314
"dependencies": {

0 commit comments

Comments
 (0)