-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add Cloudflare Pages deploy pipeline for UI #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f569c9f
7b84dd9
6275450
2ca1ceb
da96fa8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,61 @@ | |||||||||||||||||||||||||||||
| name: Deploy Pages | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||
| workflow_dispatch: | |||||||||||||||||||||||||||||
| push: | |||||||||||||||||||||||||||||
| branches: [main] | |||||||||||||||||||||||||||||
| paths: | |||||||||||||||||||||||||||||
| - 'ui/**' | |||||||||||||||||||||||||||||
| - '.github/workflows/deploy-pages.yml' | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||
| get-credentials: | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
chitcommit marked this conversation as resolved.
Show resolved
Hide resolved
|
|||||||||||||||||||||||||||||
| outputs: | |||||||||||||||||||||||||||||
| cloudflare_token: ${{ steps.creds.outputs.cloudflare_token }} | |||||||||||||||||||||||||||||
| account_id: ${{ steps.creds.outputs.account_id }} | |||||||||||||||||||||||||||||
chitcommit marked this conversation as resolved.
Show resolved
Hide resolved
|
|||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| repository: CHITTYOS/chittyops | |||||||||||||||||||||||||||||
| sparse-checkout: .github/actions/getchitty-creds | |||||||||||||||||||||||||||||
| path: .chittyops | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Fetch ephemeral credentials | |||||||||||||||||||||||||||||
| id: creds | |||||||||||||||||||||||||||||
| uses: ./.chittyops/.github/actions/getchitty-creds | |||||||||||||||||||||||||||||
chitcommit marked this conversation as resolved.
Show resolved
Hide resolved
|
|||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| api_key: ${{ secrets.CHITTYCONNECT_API_KEY }} | |||||||||||||||||||||||||||||
| purpose: 'pages-deploy' | |||||||||||||||||||||||||||||
| service: 'chittycommand-ui' | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| deploy: | |||||||||||||||||||||||||||||
|
Comment on lines
+13
to
+32
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 3 days ago To fix this, explicitly set the GITHUB_TOKEN permissions for the The best minimal fix without changing existing functionality is to add a Concretely, in permissions:
contents: readdirectly beneath
Suggested changeset
1
.github/workflows/deploy-pages.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
Refresh and try again.
|
|||||||||||||||||||||||||||||
| needs: get-credentials | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| permissions: | |||||||||||||||||||||||||||||
| contents: read | |||||||||||||||||||||||||||||
| deployments: write | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - uses: actions/setup-node@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| node-version: '20' | |||||||||||||||||||||||||||||
| cache: 'npm' | |||||||||||||||||||||||||||||
| cache-dependency-path: ui/package-lock.json | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||||||||
| run: npm ci | |||||||||||||||||||||||||||||
| working-directory: ui | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Build | |||||||||||||||||||||||||||||
| run: npm run build | |||||||||||||||||||||||||||||
| working-directory: ui | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Deploy to Cloudflare Pages | |||||||||||||||||||||||||||||
| uses: cloudflare/wrangler-action@v3 | |||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| apiToken: ${{ needs.get-credentials.outputs.cloudflare_token }} | |||||||||||||||||||||||||||||
| accountId: ${{ needs.get-credentials.outputs.account_id }} | |||||||||||||||||||||||||||||
| command: pages deploy dist --project-name=chittycommand-ui | |||||||||||||||||||||||||||||
| workingDirectory: ui | |||||||||||||||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| VITE_API_URL=https://command.chitty.cc/api | ||
| VITE_AUTH_URL=https://command.chitty.cc/auth |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| name = "chittycommand-ui" | ||
| pages_build_output_dir = "dist" | ||
| compatibility_date = "2026-01-15" |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 3 days ago
In general, the fix is to define explicit
permissions:for the workflow or individual jobs, granting only the scopes and access levels actually required. For simple CI workflows that only check out code and run tests,contents: readis usually sufficient. Since all jobs here are pure CI (secret policy check, secret scan, build, and UI build), they only need read access to repository contents.The most straightforward fix without changing functionality is to add a top‑level
permissions:block applying to all jobs, directly under thename: CI(or beforeon:). This will restrictGITHUB_TOKENto read-only on repository contents for every job, satisfying CodeQL and aligning with least-privilege. No other code needs to change, and no job appears to need broader permissions likepull-requests: writeorcontents: write.Concretely, in
.github/workflows/ci.yml, insert:after line 1 (
name: CI) and before theon:block. No imports or additional methods are needed; it’s purely a YAML configuration change.