diff --git a/.github/labeler.yml b/.github/labeler.yml index f2ce7eb..0a4aa03 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,29 +1,39 @@ -bug: - - 'fix:' - - 'bug:' - - 'error:' -feature: - - 'feat:' -enhancement: - - 'enhancement:' - - 'improvement:' -documentation: - - 'docs:' - - 'documentation:' -chore: - - 'chore:' -style: - - 'style:' -refactor: - - 'refactor:' -performance: - - 'perf:' -test: - - 'test:' - - 'tests:' -build: - - 'build:' +feat: + - head-branch: ["^feature", "feature", "feat"] + +fix: + - head-branch: ["^fix", "fixed"] + +tooling: + - changed-files: + - any-glob-to-any-file: + - tooling/* + ci: - - 'ci:' -revert: - - 'revert:' + - changed-files: + - any-glob-to-any-file: + - .github/* + +infra: + - changed-files: + - any-glob-to-any-file: + - infra/* + +env: + - changed-files: + - any-glob-to-any-file: + - packages/env/* +blog: + - changed-files: + - any-glob-to-any-file: + - apps/blog/* + +www: + - changed-files: + - any-glob-to-any-file: + - apps/www/* + +api: + - changed-files: + - any-glob-to-any-file: + - apps/api/* diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml new file mode 100644 index 0000000..d9326dd --- /dev/null +++ b/.github/workflows/label.yml @@ -0,0 +1,20 @@ +# this auto labels PRs based on the configuration file +# have a look at ./github/labeler.yml` +name: CI + +on: + - pull_request_target + +jobs: + label_pr-triage: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + if: github.repository_owner == 'ashgw' + steps: + - uses: actions/checkout@v4 + - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + sync-labels: true diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index dfa7822..44d7b9e 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -12,7 +12,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 with: - repository: 'ashgw/ashgw.me' + repository: "ashgw/ashgw.me" - name: Assign PR to opener env: @@ -25,12 +25,6 @@ jobs: -d "{\"assignees\": [\"${OPENER}\"]}" \ https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/assignees - - name: Label PR based on commits - uses: actions/labeler@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - sync-labels: true - - name: Validate PR title uses: amannn/action-semantic-pull-request@v5 id: lint_pr_title diff --git a/packages/env/index.ts b/packages/env/index.ts index fdb4b58..868dcda 100644 --- a/packages/env/index.ts +++ b/packages/env/index.ts @@ -5,6 +5,8 @@ import { createEnv } from "@ashgw/ts-env"; config({ path: require("path").resolve(__dirname, "../../.env") }); +const isBrowser = typeof window !== "undefined"; + export const env = createEnv({ vars: { NODE_ENV: z.enum(["production", "development", "preview"]), @@ -15,6 +17,5 @@ export const env = createEnv({ }, disablePrefix: ["NODE_ENV"], prefix: "NEXT_PUBLIC", - // @ts-expect-error skip in browser - skipValidation: typeof window === "undefined" ? false : true, + skipValidation: isBrowser, }); diff --git a/packages/env/tsconfig.json b/packages/env/tsconfig.json index 99fa424..9a946ec 100644 --- a/packages/env/tsconfig.json +++ b/packages/env/tsconfig.json @@ -1,5 +1,6 @@ { "extends": "@ashgw/tsconfig/base.json", "include": ["."], + "compilerOptions": { "lib": ["DOM", "ES2022"] }, "exclude": ["node_modules"] }