diff --git a/.github/actions/pass/action.yml b/.github/actions/pass/action.yml new file mode 100644 index 0000000..d46144d --- /dev/null +++ b/.github/actions/pass/action.yml @@ -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 diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 0c0798b..5acd782 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -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' diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index fe2e7ba..948000d 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -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' diff --git a/src/lib/types/product.type.ts b/src/lib/types/product.type.ts index 5b323c5..c2e80ab 100644 --- a/src/lib/types/product.type.ts +++ b/src/lib/types/product.type.ts @@ -1,3 +1,5 @@ +export type ProductStatusType = 'IN_STOCK' | 'OUT_OF_STOCK' | 'HIDDEN'; + export type ProductType = { id: number; name: string; @@ -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; };