Skip to content

Commit

Permalink
Create GitHub action to check pull requests (#654)
Browse files Browse the repository at this point in the history
create pull-request github action to check linting
  • Loading branch information
sonngdev authored Nov 30, 2023
1 parent 06e946d commit 52cd6eb
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 25 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check the pull request

on: pull_request

jobs:
check-pull-request:
name: Check code styling and run tests
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Use the correct Node.js version
uses: actions/setup-node@v4
with:
node-version: "18.17.1"
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
- name: Run Prettier
run: npm run prettier
- name: Run Jest tests
run: npm run test:jest
2 changes: 1 addition & 1 deletion app/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export default async function sitemap() {
} catch (error) {
Sentry.captureException(error);
}
}
}
40 changes: 20 additions & 20 deletions cdk/lib/app-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class AppStack extends cdk.Stack {
const domainName = ssm.StringParameter.valueForStringParameter(
this,
`/env/domainName`,
1
1,
);

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

taskDef
Expand All @@ -72,57 +72,57 @@ export class AppStack extends cdk.Stack {
ssm.StringParameter.fromSecureStringParameterAttributes(
this,
"sentryEnvironment",
{ parameterName: "/env/sentry/environment", version: 1 }
)
{ parameterName: "/env/sentry/environment", version: 1 },
),
),
SENTRY_DSN: ecs.Secret.fromSsmParameter(
ssm.StringParameter.fromSecureStringParameterAttributes(
this,
"sentryDsn",
{ parameterName: "/env/sentry/dsn", version: 1 }
)
{ parameterName: "/env/sentry/dsn", version: 1 },
),
),
DATABASE_URL: ecs.Secret.fromSsmParameter(
ssm.StringParameter.fromSecureStringParameterAttributes(
this,
"dbUrl",
{ parameterName: "/env/db/dbUrl", version: 1 }
)
{ parameterName: "/env/db/dbUrl", version: 1 },
),
),
GITHUB_SECRET: ecs.Secret.fromSsmParameter(
ssm.StringParameter.fromStringParameterName(
this,
"githubSecret",
"/env/githubSecret"
)
"/env/githubSecret",
),
),
GITHUB_ID: ecs.Secret.fromSsmParameter(
ssm.StringParameter.fromStringParameterName(
this,
"githubId",
"/env/githubId"
)
"/env/githubId",
),
),
NEXTAUTH_SECRET: ecs.Secret.fromSsmParameter(
ssm.StringParameter.fromStringParameterName(
this,
"nextauthSecret",
"/env/nextauthSecret"
)
"/env/nextauthSecret",
),
),
DISCORD_INVITE_URL: ecs.Secret.fromSsmParameter(
ssm.StringParameter.fromStringParameterName(
this,
"discordInviteUrl",
"/env/discordInviteUrl"
)
"/env/discordInviteUrl",
),
),
ADMIN_EMAIL: ecs.Secret.fromSsmParameter(
ssm.StringParameter.fromStringParameterName(
this,
"adminEmail",
"/env/adminEmail"
)
"/env/adminEmail",
),
),
},
logging: ecs.LogDrivers.awsLogs({
Expand All @@ -143,7 +143,7 @@ export class AppStack extends cdk.Stack {
cpu: production ? 256 : 256, // Can alter if need more
publicLoadBalancer: true,
protocol: elbv2.ApplicationProtocol.HTTP,
}
},
);

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

fargateService.service.connections.allowFromAnyIpv4(
ec2.Port.tcp(this.appPort),
"app-inbound"
"app-inbound",
);

this.loadbalancer = fargateService.loadBalancer;
Expand Down
6 changes: 3 additions & 3 deletions components/ArticleMenu/ArticleMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const ArticleMenu = ({
/>
</button>

<Popover className="ml-4 relative">
<Popover className="relative ml-4">
<Popover.Button
onClick={openPopoverPanel}
className="rounded-full p-1 hover:bg-neutral-300 dark:hover:bg-neutral-800"
Expand All @@ -177,7 +177,7 @@ const ArticleMenu = ({
leaveTo="transform opacity-0 scale-95"
>
<Popover.Panel
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
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
${isPopoverPanelOpen ? "" : "hidden"}`}
>
<div>
Expand Down Expand Up @@ -205,7 +205,7 @@ const ArticleMenu = ({
{label}
</button>
</li>
<li className="block px-4 py-2 text-neutral-900 dark:text-neutral-700 hover:bg-neutral-200 rounded">
<li className="block rounded px-4 py-2 text-neutral-900 hover:bg-neutral-200 dark:text-neutral-700">
<button onClick={closePopoverPanel}>
<ReportModal
type="post"
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
"ci-build": "prisma generate && next build",
"start": "next start",
"lint": "next lint",
"lint:fix": "next lint --fix",
"prettier": "prettier --check -c '**/*.{ts,tsx,js,jsx,json,json5,scss,css,html,mdx}'",
"prettier:fix": "prettier --write -c '**/*.{ts,tsx,js,jsx,json,json5,scss,css,html,mdx}'",
"test:e2e": "playwright test",
"test:jest": "jest --collectCoverage",
"studio": "prisma studio",
"migrate": "npx prisma migrate",
"prettier": "prettier --write -c '**/*.{ts,tsx,js,jsx,json,json5,scss,css,html,mdx}'",
"prepare": "husky install"
},
"prisma": {
Expand Down

0 comments on commit 52cd6eb

Please sign in to comment.