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
84 changes: 84 additions & 0 deletions .github/actions/pass/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: 'Pass Action'
description: 'Run common checks for the project (lint, format, type check, test, build)'
outputs:
all_pass:
description: 'Whether all checks passed'
value: ${{ steps.check_results.outputs.all_pass }}

runs:
using: 'composite'
steps:
- name: Setup Node.js 20.x for corepack
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org/'
scope: '@ummgoban'

- name: Enable Corepack and Set yarn Version
shell: bash
run: |
npm install -g corepack@latest
corepack enable

- name: Setup Node.js 20.x for yarn
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: yarn

- name: Install dependencies
shell: bash
run: yarn install

- name: Lint
id: lint_check
shell: bash
continue-on-error: true
run: |
yarn lint:check
echo $? > lint_result

- name: Format
id: format_check
shell: bash
continue-on-error: true
run: |
yarn format:check
echo $? > format_result

- name: Type Check
id: type_check
shell: bash
continue-on-error: true
run: |
yarn type-check
echo $? > type_result

- name: Test
id: test_check
shell: bash
continue-on-error: true
run: |
yarn test
echo $? > test_result

- name: Build
id: build
shell: bash
continue-on-error: true
run: |
yarn build
echo $? > build_result

- name: Check Lint & Format & Type Check & Test & Build Results
id: check_results
shell: bash
run: |
if [ "$(cat lint_result)" -eq 0 ] && [ "$(cat format_result)" -eq 0 ] && [ "$(cat type_result)" -eq 0 ] && [ "$(cat test_result)" -eq 0 ] && [ "$(cat build_result)" -eq 0 ]; then
echo "all_pass=true" >> $GITHUB_OUTPUT
echo "all_pass=true" >> $GITHUB_ENV
else
echo "all_pass=false" >> $GITHUB_OUTPUT
echo "all_pass=false" >> $GITHUB_ENV
fi
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- name: Run common checks
id: pass
uses: ./.github/actions/pass.yml
uses: ./.github/actions/pass

- name: Check results
if: steps.pass.outputs.all_pass != 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:

- name: Run common checks
id: pass
uses: ./.github/actions/pass.yml
uses: ./.github/actions/pass

- name: Publish
if: steps.pass.outputs.all_pass == 'true'
Expand Down
4 changes: 3 additions & 1 deletion src/lib/types/product.type.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export type ProductStatusType = 'IN_STOCK' | 'OUT_OF_STOCK' | 'HIDDEN';

export type ProductType = {
id: number;
name: string;
Expand All @@ -6,7 +8,7 @@ export type ProductType = {
discountPrice: number;
discountRate: number;
tags: TagType[];
productStatus: 'IN_STOCK' | 'OUT_OF_STOCK' | 'HIDDEN';
productStatus: ProductStatusType;
stock: number;
count?: number;
};
Expand Down