Repository navigation
Setup CI. #1
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
base: main
Are you sure you want to change the base?
Setup CI. #1
Changes from all commits
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 |
|---|---|---|
|
|
@@ -10,9 +10,6 @@ concurrency: | |
| group: preview-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| CLOUDFLARE_WORKER: ${{ vars.CLOUDFLARE_WORKER || 'marble-docs' }} | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
@@ -52,43 +49,26 @@ jobs: | |
| if: github.event.pull_request.head.repo.full_name == github.repository | ||
| permissions: | ||
| contents: read | ||
| deployments: write | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| sparse-checkout: wrangler.jsonc | ||
| sparse-checkout-cone-mode: false | ||
|
|
||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 24 | ||
|
|
||
| - id: deploy | ||
| env: | ||
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
| WRANGLER_OUTPUT_FILE_PATH: ${{ runner.temp }}/wrangler-output.ndjson | ||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||
| HEAD_SHA: ${{ github.event.pull_request.head.sha }} | ||
| run: | | ||
| npx --yes wrangler@4.149.0 versions upload \ | ||
| --name "$CLOUDFLARE_WORKER" \ | ||
| --preview-alias "pr-$PR_NUMBER" \ | ||
| --message "PR #$PR_NUMBER ($HEAD_SHA)" | ||
|
|
||
| jq -r 'select(.type == "version-upload") | "alias-url=\(.preview_alias_url // "")\nurl=\(.preview_url // "")"' \ | ||
| "$WRANGLER_OUTPUT_FILE_PATH" >> "$GITHUB_OUTPUT" | ||
| uses: cloudflare/wrangler-action@v3 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win Pin the Wrangler action to a full commit SHA.
Based on learnings, third-party GitHub Actions must use full commit SHAs rather than mutable tags. 🤖 Prompt for AI AgentsSource: Learnings |
||
| with: | ||
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
| command: pages deploy dist --project-name=marble-docs --branch=pr-${{ github.event.pull_request.number }} --commit-hash=${{ github.event.pull_request.head.sha }} | ||
|
|
||
| - uses: marocchino/sticky-pull-request-comment@v2 | ||
| with: | ||
| header: preview | ||
| message: | | ||
| 📘 **Docs preview:** ${{ steps.deploy.outputs.alias-url }} | ||
| 📘 **Docs preview:** ${{ steps.deploy.outputs.pages-deployment-alias-url }} | ||
|
|
||
| This commit (`${{ github.event.pull_request.head.sha }}`): ${{ steps.deploy.outputs.url }} | ||
| This commit (`${{ github.event.pull_request.head.sha }}`): ${{ steps.deploy.outputs.deployment-url }} | ||
| API reference from `checkmarble/marble-backend@${{ needs.build.outputs.openapi-ref }}`. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ dist/ | |
|
|
||
| node_modules/ | ||
| .astro/ | ||
| .wrangler/ | ||
|
|
||
| .DS_Store | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,5 @@ | ||
| { | ||
| "name": "marble-docs", | ||
| "compatibility_date": "2026-10-01", | ||
| "pages_build_output_dir": "dist", | ||
| "assets": { | ||
| "directory": "./dist", | ||
| "not_found_handling": "404-page" | ||
| } | ||
| "name": "marble-docs", | ||
| "compatibility_date": "2026-10-01", | ||
| "pages_build_output_dir": "./dist", | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
Remove the unused deployment write permission.
The action receives no
gitHubTokeninput, so this job does not needdeployments: writefor the Pages deployment or PR comment. Remove the scope unless the workflow also intends to create a GitHub Deployment. (github.com)Based on learnings, grant CI jobs only the token scopes they use.
🤖 Prompt for AI Agents
Source: Learnings