Skip to content

Commit 52cd6eb

Browse files
authored
Create GitHub action to check pull requests (#654)
create pull-request github action to check linting
1 parent 06e946d commit 52cd6eb

File tree

5 files changed

+50
-25
lines changed

5 files changed

+50
-25
lines changed

.github/workflows/pull-request.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check the pull request
2+
3+
on: pull_request
4+
5+
jobs:
6+
check-pull-request:
7+
name: Check code styling and run tests
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout source code
11+
uses: actions/checkout@v4
12+
- name: Use the correct Node.js version
13+
uses: actions/setup-node@v4
14+
with:
15+
node-version: "18.17.1"
16+
- name: Install dependencies
17+
run: npm ci
18+
- name: Run ESLint
19+
run: npm run lint
20+
- name: Run Prettier
21+
run: npm run prettier
22+
- name: Run Jest tests
23+
run: npm run test:jest

app/sitemap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ export default async function sitemap() {
99
} catch (error) {
1010
Sentry.captureException(error);
1111
}
12-
}
12+
}

cdk/lib/app-stack.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class AppStack extends cdk.Stack {
2828
const domainName = ssm.StringParameter.valueForStringParameter(
2929
this,
3030
`/env/domainName`,
31-
1
31+
1,
3232
);
3333

3434
const wwwDomainName = `www.${domainName}`;
@@ -55,7 +55,7 @@ export class AppStack extends cdk.Stack {
5555
effect: iam.Effect.ALLOW,
5656
actions: ["s3:*Object", "SES:*"],
5757
resources: ["*"],
58-
})
58+
}),
5959
);
6060

6161
taskDef
@@ -72,57 +72,57 @@ export class AppStack extends cdk.Stack {
7272
ssm.StringParameter.fromSecureStringParameterAttributes(
7373
this,
7474
"sentryEnvironment",
75-
{ parameterName: "/env/sentry/environment", version: 1 }
76-
)
75+
{ parameterName: "/env/sentry/environment", version: 1 },
76+
),
7777
),
7878
SENTRY_DSN: ecs.Secret.fromSsmParameter(
7979
ssm.StringParameter.fromSecureStringParameterAttributes(
8080
this,
8181
"sentryDsn",
82-
{ parameterName: "/env/sentry/dsn", version: 1 }
83-
)
82+
{ parameterName: "/env/sentry/dsn", version: 1 },
83+
),
8484
),
8585
DATABASE_URL: ecs.Secret.fromSsmParameter(
8686
ssm.StringParameter.fromSecureStringParameterAttributes(
8787
this,
8888
"dbUrl",
89-
{ parameterName: "/env/db/dbUrl", version: 1 }
90-
)
89+
{ parameterName: "/env/db/dbUrl", version: 1 },
90+
),
9191
),
9292
GITHUB_SECRET: ecs.Secret.fromSsmParameter(
9393
ssm.StringParameter.fromStringParameterName(
9494
this,
9595
"githubSecret",
96-
"/env/githubSecret"
97-
)
96+
"/env/githubSecret",
97+
),
9898
),
9999
GITHUB_ID: ecs.Secret.fromSsmParameter(
100100
ssm.StringParameter.fromStringParameterName(
101101
this,
102102
"githubId",
103-
"/env/githubId"
104-
)
103+
"/env/githubId",
104+
),
105105
),
106106
NEXTAUTH_SECRET: ecs.Secret.fromSsmParameter(
107107
ssm.StringParameter.fromStringParameterName(
108108
this,
109109
"nextauthSecret",
110-
"/env/nextauthSecret"
111-
)
110+
"/env/nextauthSecret",
111+
),
112112
),
113113
DISCORD_INVITE_URL: ecs.Secret.fromSsmParameter(
114114
ssm.StringParameter.fromStringParameterName(
115115
this,
116116
"discordInviteUrl",
117-
"/env/discordInviteUrl"
118-
)
117+
"/env/discordInviteUrl",
118+
),
119119
),
120120
ADMIN_EMAIL: ecs.Secret.fromSsmParameter(
121121
ssm.StringParameter.fromStringParameterName(
122122
this,
123123
"adminEmail",
124-
"/env/adminEmail"
125-
)
124+
"/env/adminEmail",
125+
),
126126
),
127127
},
128128
logging: ecs.LogDrivers.awsLogs({
@@ -143,7 +143,7 @@ export class AppStack extends cdk.Stack {
143143
cpu: production ? 256 : 256, // Can alter if need more
144144
publicLoadBalancer: true,
145145
protocol: elbv2.ApplicationProtocol.HTTP,
146-
}
146+
},
147147
);
148148

149149
fargateService.listener.addAction("DefaultListenerRule", {
@@ -197,7 +197,7 @@ export class AppStack extends cdk.Stack {
197197

198198
fargateService.service.connections.allowFromAnyIpv4(
199199
ec2.Port.tcp(this.appPort),
200-
"app-inbound"
200+
"app-inbound",
201201
);
202202

203203
this.loadbalancer = fargateService.loadBalancer;

components/ArticleMenu/ArticleMenu.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ const ArticleMenu = ({
159159
/>
160160
</button>
161161

162-
<Popover className="ml-4 relative">
162+
<Popover className="relative ml-4">
163163
<Popover.Button
164164
onClick={openPopoverPanel}
165165
className="rounded-full p-1 hover:bg-neutral-300 dark:hover:bg-neutral-800"
@@ -177,7 +177,7 @@ const ArticleMenu = ({
177177
leaveTo="transform opacity-0 scale-95"
178178
>
179179
<Popover.Panel
180-
className={`origin-top-right absolute bottom-14 right-0 lg:left-16 lg:bottom-0 mt-2 w-48 rounded-md shadow-lg py-1 bg-white dark:bg-white ring-1 px-1 ring-black ring-opacity-5 focus:outline-none
180+
className={`absolute bottom-14 right-0 mt-2 w-48 origin-top-right rounded-md bg-white px-1 py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:bg-white lg:bottom-0 lg:left-16
181181
${isPopoverPanelOpen ? "" : "hidden"}`}
182182
>
183183
<div>
@@ -205,7 +205,7 @@ const ArticleMenu = ({
205205
{label}
206206
</button>
207207
</li>
208-
<li className="block px-4 py-2 text-neutral-900 dark:text-neutral-700 hover:bg-neutral-200 rounded">
208+
<li className="block rounded px-4 py-2 text-neutral-900 hover:bg-neutral-200 dark:text-neutral-700">
209209
<button onClick={closePopoverPanel}>
210210
<ReportModal
211211
type="post"

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
"ci-build": "prisma generate && next build",
99
"start": "next start",
1010
"lint": "next lint",
11+
"lint:fix": "next lint --fix",
12+
"prettier": "prettier --check -c '**/*.{ts,tsx,js,jsx,json,json5,scss,css,html,mdx}'",
13+
"prettier:fix": "prettier --write -c '**/*.{ts,tsx,js,jsx,json,json5,scss,css,html,mdx}'",
1114
"test:e2e": "playwright test",
1215
"test:jest": "jest --collectCoverage",
1316
"studio": "prisma studio",
1417
"migrate": "npx prisma migrate",
15-
"prettier": "prettier --write -c '**/*.{ts,tsx,js,jsx,json,json5,scss,css,html,mdx}'",
1618
"prepare": "husky install"
1719
},
1820
"prisma": {

0 commit comments

Comments
 (0)