Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/config/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# ref:
# for `javascript-typescript` codeql-suites: https://github.com/github/codeql/tree/main/javascript/ql/src/codeql-suites
# for `actions` codeql-suites: https://github.com/github/codeql/tree/main/actions/ql/src/codeql-suites

name: "CodeQL configurations"

queries:
- uses: security-and-quality
2 changes: 1 addition & 1 deletion .github/workflows/backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
RAPID_API_KEY: ${{ secrets.RAPID_API_KEY }}

jobs:
image_build_and_push:
build-and-ship:
name: Build & Ship OCI image
runs-on: ubuntu-24.04

Expand Down
22 changes: 2 additions & 20 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,67 +11,49 @@
workflow_dispatch:

jobs:
build_and_test:
name: Build
build-apps:
name: Build Apps
runs-on: ubuntu-24.04

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node.js environment
uses: actions/setup-node@v4
with:
node-version: 20.9.0

- name: Filter Path
uses: dorny/paths-filter@v3
id: filter
with:
filters: '.github/config/paths-filter.yaml'
# https://github.com/dorny/paths-filter

# Run only for Backend
- name: Install dependencies
if: steps.filter.outputs.api == 'true'
working-directory: ./api-server
run: |
npm ci

- name: Run Jest
if: steps.filter.outputs.api == 'true'
working-directory: ./api-server
run: |
npx jest

- name: Install pack
if: steps.filter.outputs.api == 'true'
uses: buildpacks/github-actions/setup-pack@v5.8.6

- name: Build Express App
if: steps.filter.outputs.api == 'true'
run: |
pack build ghcr.io/hwakabh/gh-pages-api:local \
--builder gcr.io/buildpacks/builder:latest \
--path ./api-server/

# Run only for Frontend
- name: Install dependencies
if: steps.filter.outputs.ui == 'true'
working-directory: ./web-frontend
run: |
npm ci

- name: Run Vitest for compoenent testings
if: steps.filter.outputs.ui == 'true'
working-directory: ./web-frontend
run: |
npx vitest run

- name: Build Vite App
if: steps.filter.outputs.ui == 'true'
working-directory: ./web-frontend
env:
VITE_API_ENDPOINT: ${{ secrets.VITE_API_ENDPOINT }}
run: |
npx vite build

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
36 changes: 36 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CodeQL

on:
pull_request:
workflow_dispatch:
Comment on lines +3 to +5
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add workflow-level permissions declaration.

Following the principle of least privilege, explicitly declare workflow-level permissions:

permissions: read-all


jobs:
codeql:
name: CodeQL
runs-on: ubuntu-24.04

permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
# https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#changing-the-languages-that-are-analyzed
language:
- 'javascript-typescript'
- 'actions'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
config-file: ./.github/config/codeql.yaml

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
2 changes: 1 addition & 1 deletion .github/workflows/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_dispatch:

jobs:
build:
build-and-deploy:
name: Build Vue app and Deploy
runs-on: ubuntu-24.04
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/git-pr-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:

jobs:
git_pr_release:
git-pr-release:
name: git-pr-release
runs-on: ubuntu-24.04

Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Tests CI

on:
pull_request:
# triggered only when PR created with its target to main
branches:
- 'main'
paths:
- 'api-server/**'
- 'web-frontend/**'
workflow_dispatch:

jobs:
tests:
name: Tests
runs-on: ubuntu-24.04

permissions:
issues: write
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Filter Path
uses: dorny/paths-filter@v3
id: filter
with:
filters: '.github/config/paths-filter.yaml'
# https://github.com/dorny/paths-filter
Comment on lines +26 to +31
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Pin third-party action to specific commit.

For security, pin the dorny/paths-filter action to a specific commit hash instead of using a tag:

-    uses: dorny/paths-filter@v3
+    uses: dorny/paths-filter@4512585405ef951d0fe8899ba468f8d5e711e2e3  # v3
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Filter Path
uses: dorny/paths-filter@v3
id: filter
with:
filters: '.github/config/paths-filter.yaml'
# https://github.com/dorny/paths-filter
- name: Filter Path
uses: dorny/paths-filter@4512585405ef951d0fe8899ba468f8d5e711e2e3 # v3
id: filter
with:
filters: '.github/config/paths-filter.yaml'
# https://github.com/dorny/paths-filter
🧰 Tools
🪛 GitHub Check: CodeQL

[warning] 23-23: Unpinned tag for a non-immutable Action in workflow
Unpinned 3rd party Action 'Tests CI' step Uses Step: filter uses 'dorny/paths-filter' with ref 'v3', not a pinned commit hash


- name: Setup node.js environment
uses: actions/setup-node@v4
with:
node-version: 20.9.0

# Run only for Backend
- name: Install dependencies
if: steps.filter.outputs.api == 'true'
working-directory: ./api-server
run: |
npm ci

- name: Run Jest
if: steps.filter.outputs.api == 'true'
working-directory: ./api-server
run: |
npx jest

# Run only for Frontend
- name: Install dependencies
if: steps.filter.outputs.ui == 'true'
working-directory: ./web-frontend
run: |
npm ci

- name: Run Vitest for compoenent testings
if: steps.filter.outputs.ui == 'true'
working-directory: ./web-frontend
run: |
npx vitest run
2 changes: 1 addition & 1 deletion .github/workflows/triage-issues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:
contents: read

jobs:
triage_issue:
triage-issue:
runs-on: ubuntu-24.04
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/triage-pull-requests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:
pull-requests: write

jobs:
triage_pr:
triage-pr:
runs-on: ubuntu-24.04
steps:
- name: Checkout
Expand Down
Loading