diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 0000000..9637bac --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,42 @@ +language: "jp" +early_access: false +reviews: + request_changes_workflow: false + high_level_summary: true + poem: true + review_status: true + collapse_walkthrough: false + path_filters: + - "!**/.toml" + - "!**/.yml" + path_instructions: + - path: "**/*.py" + instructions: | + あなたは @coderabbitai(別名 github-actions[bot])で、OpenAIによって訓練された言語モデルです。 + あなたの目的は、非常に経験豊富なソフトウェアエンジニアとして機能し、コードの一部を徹底的にレビューし、 + 以下のようなキーエリアを改善するためのコードスニペットを提案することです: + - ロジック + - セキュリティ + - パフォーマンス + - データ競合 + - 一貫性 + - エラー処理 + - 保守性 + - モジュール性 + - 複雑性 + - 最適化 + - ベストプラクティス: DRY, SOLID, KISS + + 些細なコードスタイルの問題や、コメント・ドキュメントの欠落についてはコメントしないでください。 + 重要な問題を特定し、解決して全体的なコード品質を向上させることを目指してくださいが、細かい問題は意図的に無視してください。 + auto_review: + enabled: true + ignore_title_keywords: + - "WIP" + - "DO NOT MERGE" + drafts: false + base_branches: + - "develop" + - "feature/*" +chat: + auto_reply: true diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml new file mode 100644 index 0000000..7d0b586 --- /dev/null +++ b/.github/pr-labeler.yml @@ -0,0 +1,14 @@ +feature: + - 'feature/*' + - 'feat/*' +refactor: + - 'refactor/*' +bug: + - 'fix/*' +minor: + - 'release/*' + - 'feature/*' + - 'feat/*' + - 'refactor/*' +chore: + - 'chore/*' diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..e6789e0 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,31 @@ +name-template: '$RESOLVED_VERSION' +tag-template: '$RESOLVED_VERSION' +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '🧰 Maintenance' + label: 'chore' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: minor +template: | + ## Changes + + $CHANGES diff --git a/.github/workflows/pr_label.yml b/.github/workflows/pr_label.yml new file mode 100644 index 0000000..1bf4a71 --- /dev/null +++ b/.github/workflows/pr_label.yml @@ -0,0 +1,15 @@ +name: pull request label +on: + pull_request: + types: [opened] +permissions: + pull-requests: write + contents: read +jobs: + pr-labeler: + runs-on: ubuntu-latest + steps: + - uses: TimonVS/pr-labeler-action@v4 + name: make label + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7c3cf84 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: make release +on: + pull_request: + types: + - closed + branches: + - main + push: + tags: + - '*' + workflow_dispatch: {} +env: + cache-unique-key: mahjong-rust-ai +permissions: + id-token: write + contents: read +jobs: + release: + permissions: + # write permission is required to create a github release + contents: write + # write permission is required for autolabeler + # otherwise, read permission is required at least + pull-requests: read + runs-on: ubuntu-latest + if: ${{ github.event.pull_request.merged == true }} + steps: + - name: Create Release + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + publish: true diff --git a/src/App.tsx b/src/App.tsx index e49677b..51b5d2f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -11,15 +11,24 @@ import { RequireAuth } from './components/atoms/RequireAuth' import { SignIn } from './pages/signin' import { OpenAPI } from './apis/analysis' import { StatisticsIndex } from './pages/statistics' +import { useAuth0 } from '@auth0/auth0-react' +import { useEffect } from 'react' +import { fetchAPIToken } from './hooks/common/useToken' const SentryRoutes = Sentry.withSentryReactRouterV6Routing(Routes) function App() { + const { isLoading, isAuthenticated, getAccessTokenSilently } = useAuth0() const theme = createTheme({ palette: { mode: 'light', }, }) + useEffect(() => { + if (!isLoading && isAuthenticated) { + fetchAPIToken(getAccessTokenSilently) + } + }, [isAuthenticated, getAccessTokenSilently, isLoading]) OpenAPI.BASE = import.meta.env.VITE_API_BASE return (