Skip to content

feat: add lint and build GitHub Actions for pull requests#13

Merged
SimonLoir merged 5 commits intomainfrom
copilot/add-lint-and-build-actions
Nov 7, 2025
Merged

feat: add lint and build GitHub Actions for pull requests#13
SimonLoir merged 5 commits intomainfrom
copilot/add-lint-and-build-actions

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 7, 2025

Add lint and build GitHub Actions checks for pull requests in 2 different actions

This PR adds two separate GitHub Actions workflows for pull requests:

Completed:

  • Create .github/workflows/lint.yml - Workflow to run lint checks on all code for pull requests
  • Create .github/workflows/build.yml - Workflow to build the apps/web app specifically for pull requests
  • Test that both workflows are properly configured and will trigger on pull requests
  • Ensure workflows include proper dependency installation and caching
  • Add clarifying comments about CI-only placeholder values
  • Add explicit permissions blocks to workflows for security best practices
  • Update Node.js version to 24.8.0 to match project requirements
  • Update actions/cache to v4 to avoid deprecated version error

Implementation details:

  • The lint workflow runs pnpm lint which uses Turbo to lint all packages
  • The build workflow runs pnpm --filter web build to specifically build only the apps/web app (per requirement)
  • Both workflows trigger on pull requests to the main branch
  • Both workflows use Node.js 24.8.0 (matching package.json requirement of >= 24.8.0)
  • Both workflows use pnpm version 9.0.0 (matching package.json)
  • Both workflows use actions/cache@v4 (avoiding deprecated v4.1.2)
  • Both workflows include pnpm store caching for faster builds
  • Both workflows include explicit permissions: contents: read for security
  • The build workflow includes:
    • Prisma client generation step (required before building)
    • Environment variables with CI-only placeholder values for testing (clearly documented as safe for public repositories and only used for build-time validation)

Both workflows have been tested locally and follow GitHub Actions security best practices.

Original prompt

add lint and build github actions checks for pull requests in 2 different actions


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Summary by CodeRabbit

  • Chores
    • Established automated build workflow to compile code, manage dependencies, cache packages, and prepare application artifacts for all pull requests, ensuring production readiness
    • Implemented automated code linting workflow to enforce quality standards, identify potential issues, and maintain consistent code patterns across all pull requests to the main branch

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 7, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Two new GitHub Actions workflows are introduced: one for building the application on pull requests, executing setup, dependency installation, Prisma client generation, and web app build; another for linting, performing checkout, environment setup, caching, dependency installation, and lint script execution.

Changes

Cohort / File(s) Summary
GitHub Actions Workflows
.github/workflows/build.yml, .github/workflows/lint.yml
Added two CI/CD workflows. Build workflow runs on pull requests to main with Node.js v20, pnpm v9.0.0, dependency installation, Prisma client generation, and build execution using CI-only environment placeholders. Lint workflow runs on pull requests to main with Node.js v20, pnpm v9.0.0, pnpm store caching, dependency installation, and lint script execution.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Both files are straightforward GitHub Actions YAML configurations with standard, repetitive workflow patterns
  • Environment variable placeholders in the build job should be verified for correctness (DATABASE_URL, REDIS_\, BETTER_AUTH_\, ENCRYPTION_SECRET)

Poem

🐰 A workflow's born, two scripts take flight,
Lint and build, keeping code tight,
On every pull, the checks align,
GitHub Actions make the CI shine!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly and accurately summarizes the main changes: adding two GitHub Actions workflows for linting and building on pull requests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 3 commits November 7, 2025 00:39
Co-authored-by: SimonLoir <17649337+SimonLoir@users.noreply.github.com>
Co-authored-by: SimonLoir <17649337+SimonLoir@users.noreply.github.com>
Co-authored-by: SimonLoir <17649337+SimonLoir@users.noreply.github.com>
Copilot AI changed the title [WIP] Add lint and build GitHub Actions checks for PRs Add lint and build GitHub Actions for pull requests Nov 7, 2025
Copilot AI requested a review from SimonLoir November 7, 2025 00:44
@SimonLoir SimonLoir changed the title Add lint and build GitHub Actions for pull requests feat: add lint and build GitHub Actions for pull requests Nov 7, 2025
@SimonLoir
Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 7, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@SimonLoir SimonLoir marked this pull request as ready for review November 7, 2025 00:47
Copilot AI review requested due to automatic review settings November 7, 2025 00:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds CI automation for pull requests by introducing two separate GitHub Actions workflows: one for linting and one for building the web application.

  • Adds lint workflow to run pnpm lint on all monorepo packages via Turbo
  • Adds build workflow that generates Prisma client and builds the web app with necessary environment variables
  • Both workflows use pnpm 9.0.0 with store caching and trigger on pull requests to main

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
.github/workflows/lint.yml Runs linting checks across all monorepo packages
.github/workflows/build.yml Builds the web app with Prisma client generation and required environment variables

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/lint.yml Outdated
- name: Setup Node.js
uses: actions/setup-node@v4.1.0
with:
node-version: '20'
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Node.js version specified (20) does not meet the project's minimum requirement. According to package.json, the project requires node >= 24.8.0, but this workflow uses Node.js 20. Update to Node.js 24 or higher to match the project requirements.

Suggested change
node-version: '20'
node-version: '24.8.0'

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to Node.js 24.8.0 in commit ad4eb1c

Comment thread .github/workflows/build.yml Outdated
- name: Setup Node.js
uses: actions/setup-node@v4.1.0
with:
node-version: '20'
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Node.js version specified (20) does not meet the project's minimum requirement. According to package.json, the project requires node >= 24.8.0, but this workflow uses Node.js 20. Update to Node.js 24 or higher to match the project requirements.

Suggested change
node-version: '20'
node-version: '24.8.0'

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to Node.js 24.8.0 in commit ad4eb1c

Comment thread .github/workflows/build.yml Outdated
Comment on lines +50 to +51
# CI-only placeholder values for build testing
# These are not real credentials and are safe for public repositories
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The comments suggest these are placeholder values safe for public repositories, but they are being used for actual build testing. Consider adding a comment that explains these values are only used to satisfy build-time validation and are not used for runtime operations or actual connections.

Suggested change
# CI-only placeholder values for build testing
# These are not real credentials and are safe for public repositories
# CI-only placeholder values for build testing.
# These values are only used to satisfy build-time validation in CI and are not used for runtime operations or actual connections.
# They are not real credentials and are safe for public repositories.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improved the comment to clarify these values are only for build-time validation in commit ad4eb1c

Comment on lines +22 to +40
- name: Install pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 9.0.0

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- name: Setup pnpm cache
uses: actions/cache@v4.1.2
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This pnpm cache setup code is duplicated across both lint.yml and build.yml workflows. Consider extracting these steps into a reusable composite action or workflow to reduce duplication and ensure consistency across workflows.

Suggested change
- name: Install pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 9.0.0
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4.1.2
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Setup pnpm cache
uses: ./.github/actions/setup-pnpm-cache
with:
pnpm-version: 9.0.0

Copilot uses AI. Check for mistakes.
@SimonLoir
Copy link
Copy Markdown
Contributor

@copilot there is an error:

Error: This request has been automatically failed because it uses a deprecated version of actions/cache: v4.1.2. Please update your workflow to use v3/v4 of actions/cache to avoid interruptions. Learn more: https://github.blog/changelog/2024-12-05-notice-of-upcoming-releases-and-breaking-changes-for-github-actions/#actions-cache-v1-v2-and-actions-toolkit-cache-package-closing-down

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
.github/workflows/lint.yml (1)

1-45: Workflow structure and steps look good.

The lint workflow is well-structured with proper caching, pinned action versions, and read-only permissions. However, note that the environment setup (checkout, Node.js, pnpm, cache) is duplicated across both the lint and build workflows.

Consider extracting the common setup into a reusable workflow to reduce duplication and improve maintainability. Both workflows could call a shared setup step, reducing maintenance burden if versions or caching strategies need to be updated.

Example structure:

# .github/workflows/setup-pnpm.yml
name: Setup pnpm
on:
  workflow_call:

jobs:
  setup:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4.2.2
      # ... rest of setup ...

Then in lint.yml and build.yml:

jobs:
  lint:
    uses: ./.github/workflows/setup-pnpm.yml

(This is optional and can be deferred.)

.github/workflows/build.yml (1)

49-58: Use GitHub Secrets for environment variables to align with best practices (optional improvement).

The hardcoded placeholder credentials are already well-documented with clear comments explaining they are CI-only and non-functional. This approach is acceptable for testing. However, using clearly named dummy values documented as placeholders aligns with best practices.

To improve:

  • Store credentials in GitHub repository secrets and reference with ${{ secrets.SECRET_NAME }} instead of hardcoding
  • This eliminates potential static analysis warnings and makes credential management more explicit

The current approach is safe and works for CI testing. Migrating to GitHub Secrets would be a best-practice improvement but is not required.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 839652e and a65e29d.

📒 Files selected for processing (2)
  • .github/workflows/build.yml (1 hunks)
  • .github/workflows/lint.yml (1 hunks)
🧰 Additional context used
🪛 Checkov (3.2.334)
.github/workflows/build.yml

[medium] 52-53: Basic Auth Credentials

(CKV_SECRET_4)

🔇 Additional comments (1)
.github/workflows/build.yml (1)

44-48: Verification confirms both packages exist in the monorepo.

The workflow correctly targets valid packages:

  • @repo/db exists as a scoped package
  • web exists as a workspace package

Both pnpm filter commands will resolve correctly.

Co-authored-by: SimonLoir <17649337+SimonLoir@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 7, 2025

@copilot there is an error:

Error: This request has been automatically failed because it uses a deprecated version of actions/cache: v4.1.2. Please update your workflow to use v3/v4 of actions/cac...

Updated actions/cache from v4.1.2 to v4 in both workflows in commit ad4eb1c

@SimonLoir SimonLoir merged commit 9ff7967 into main Nov 7, 2025
3 of 5 checks passed
@SimonLoir SimonLoir deleted the copilot/add-lint-and-build-actions branch November 7, 2025 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants