-
Notifications
You must be signed in to change notification settings - Fork 38
merge main into development #2549
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
60aed86
827f617
af2f382
b4bf4e0
a72d6d4
d76bd36
491ebb2
c4b01d5
334fbdb
9216908
a32f738
35a45d8
bcc7c9e
eec7ec8
b99bb49
f92dacd
4af57df
fa6ceea
1f8432f
a1f942c
53bb3a7
64d1f67
4bac86e
4672fc8
10dbf60
cbae081
0f1c057
cbab838
24423c1
5187b6d
9980ed4
51c77ed
a9e7c3e
086ed13
5b031e1
8397d9e
0f404b5
9513605
d32dff8
7b1e6d2
f8f7be5
6353df4
36f1317
c64cf9b
603d281
916732b
2639f80
1b27205
4af87df
534e3f6
cd4e13e
46da63e
3af10be
3ce56fc
58c03c3
5049a6f
06081d7
d096a4a
7a63f84
13efe08
fdf16c3
1b7cf32
ed92701
799a4d0
62b65a1
57ac5e5
2411875
f4b4298
1bcf0ad
db8f10a
889aaa2
6e6c4a1
e1f3543
6770217
4540b91
68f2d96
c020fee
c46e448
74aef2a
84fc13f
472a21a
25acaf4
deab5b8
082aab9
af299ec
4fe7201
4b8ef08
ec0223b
2964e6b
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,280 @@ | ||
| name: Coverage | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main", "development"] | ||
| paths: | ||
| - "package.json" | ||
| - "bun.lock" | ||
| - "apps/**" | ||
| - "packages/**" | ||
| - "scripts/lint/coverage-ratchet.ts" | ||
| - "scripts/lint/coverage-baseline-update.ts" | ||
| - "scripts/lint/no-weak-assertions.ts" | ||
| - "scripts/vitest.config.ts" | ||
| - "coverage-baselines.json" | ||
| - ".github/workflows/coverage.yml" | ||
| pull_request: | ||
| branches: ["**"] | ||
| paths: | ||
| - "package.json" | ||
| - "bun.lock" | ||
| - "apps/**" | ||
| - "packages/**" | ||
| - "scripts/lint/coverage-ratchet.ts" | ||
| - "scripts/lint/coverage-baseline-update.ts" | ||
| - "scripts/lint/no-weak-assertions.ts" | ||
| - "scripts/vitest.config.ts" | ||
| - "coverage-baselines.json" | ||
| - ".github/workflows/coverage.yml" | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: write # for baseline auto-commit on main | ||
| pull-requests: write # for vitest-coverage-report-action comments | ||
|
|
||
| jobs: | ||
| # One coverage run per tracked workspace. Uploads the coverage-summary.json | ||
| # as an artifact for the ratchet job to aggregate. | ||
| coverage: | ||
| name: Coverage (${{ matrix.name }}) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| # `summary_path` / `final_path` are repo-relative (used by artifact | ||
| # upload + ratchet restore). `summary_relative` / `final_relative` | ||
| # are relative to `working_directory` (used by the coverage report | ||
| # action, which joins them with working_directory internally). | ||
| - name: packages/api | ||
| artifact_slug: packages-api | ||
| test_command: bun run --cwd packages/api test:unit:coverage | ||
| summary_path: packages/api/coverage/unit/coverage-summary.json | ||
| final_path: packages/api/coverage/unit/coverage-final.json | ||
| summary_relative: ./coverage/unit/coverage-summary.json | ||
| final_relative: ./coverage/unit/coverage-final.json | ||
| vite_config_path: ./vitest.unit.config.ts | ||
| working_directory: ./packages/api | ||
| - name: apps/expo | ||
| artifact_slug: apps-expo | ||
| test_command: bun run --cwd apps/expo test:coverage | ||
| summary_path: apps/expo/coverage/unit/coverage-summary.json | ||
| final_path: apps/expo/coverage/unit/coverage-final.json | ||
| summary_relative: ./coverage/unit/coverage-summary.json | ||
| final_relative: ./coverage/unit/coverage-final.json | ||
| vite_config_path: ./vitest.config.ts | ||
| working_directory: ./apps/expo | ||
| - name: packages/mcp | ||
| artifact_slug: packages-mcp | ||
| test_command: bun run --cwd packages/mcp test --coverage | ||
| summary_path: packages/mcp/coverage/coverage-summary.json | ||
| final_path: packages/mcp/coverage/coverage-final.json | ||
| summary_relative: ./coverage/coverage-summary.json | ||
| final_relative: ./coverage/coverage-final.json | ||
| vite_config_path: ./vitest.config.ts | ||
| working_directory: ./packages/mcp | ||
| - name: packages/analytics | ||
| artifact_slug: packages-analytics | ||
| test_command: bun run --cwd packages/analytics test --coverage | ||
| summary_path: packages/analytics/coverage/coverage-summary.json | ||
| final_path: packages/analytics/coverage/coverage-final.json | ||
| summary_relative: ./coverage/coverage-summary.json | ||
| final_relative: ./coverage/coverage-final.json | ||
| vite_config_path: ./vitest.config.ts | ||
| working_directory: ./packages/analytics | ||
| - name: packages/overpass | ||
| artifact_slug: packages-overpass | ||
| test_command: bun run --cwd packages/overpass test --coverage | ||
| summary_path: packages/overpass/coverage/coverage-summary.json | ||
| final_path: packages/overpass/coverage/coverage-final.json | ||
| summary_relative: ./coverage/coverage-summary.json | ||
| final_relative: ./coverage/coverage-final.json | ||
| vite_config_path: ./vitest.config.ts | ||
| working_directory: ./packages/overpass | ||
| - name: packages/units | ||
| artifact_slug: packages-units | ||
| test_command: bun run --cwd packages/units test --coverage | ||
| summary_path: packages/units/coverage/coverage-summary.json | ||
| final_path: packages/units/coverage/coverage-final.json | ||
| summary_relative: ./coverage/coverage-summary.json | ||
| final_relative: ./coverage/coverage-final.json | ||
| vite_config_path: ./vitest.config.ts | ||
| working_directory: ./packages/units | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
Contributor
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. Add Three checkout actions in jobs that don't push changes should disable credential persistence to minimize supply-chain risk. 🔐 Recommended fix - uses: actions/checkout@v6
+ with:
+ persist-credentials: falseApply to the checkouts in Also applies to: 150-150, 271-271 🧰 Tools🪛 zizmor (1.25.2)[warning] 109-109: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 109-109: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||
|
|
||
| - uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: latest | ||
|
|
||
| - name: Install dependencies | ||
| env: | ||
| PACKRAT_NATIVEWIND_UI_GITHUB_TOKEN: ${{ secrets.PACKRAT_NATIVEWIND_UI_GITHUB_TOKEN }} | ||
| run: bun install --frozen-lockfile | ||
|
|
||
| - name: Run coverage for ${{ matrix.name }} | ||
| run: ${{ matrix.test_command }} | ||
|
|
||
| - name: Report coverage on PR | ||
| if: always() && github.event_name == 'pull_request' | ||
| uses: davelosert/vitest-coverage-report-action@v2 | ||
| with: | ||
| name: ${{ matrix.name }} | ||
| json-summary-path: ${{ matrix.summary_relative }} | ||
| json-final-path: ${{ matrix.final_relative }} | ||
| vite-config-path: ${{ matrix.vite_config_path }} | ||
| working-directory: ${{ matrix.working_directory }} | ||
|
|
||
| - name: Upload coverage summary artifact | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-summary-${{ matrix.artifact_slug }} | ||
| path: ${{ matrix.summary_path }} | ||
| if-no-files-found: error | ||
| retention-days: 7 | ||
|
|
||
| # Aggregate every workspace's coverage-summary.json and run the ratchet. | ||
| # Fails the workflow if any workspace dropped below its baseline. | ||
| ratchet: | ||
| name: Coverage Ratchet | ||
| runs-on: ubuntu-latest | ||
| needs: coverage | ||
| if: always() | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: latest | ||
|
|
||
| - name: Install dependencies | ||
| env: | ||
| PACKRAT_NATIVEWIND_UI_GITHUB_TOKEN: ${{ secrets.PACKRAT_NATIVEWIND_UI_GITHUB_TOKEN }} | ||
| run: bun install --frozen-lockfile | ||
|
|
||
| - name: Download all coverage summaries | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: coverage-summary-* | ||
| path: artifacts | ||
|
|
||
| - name: Restore summaries to their workspace paths | ||
| run: | | ||
| set -euo pipefail | ||
| # Each artifact arrives as artifacts/coverage-summary-<slug>/<path-without-leading-dir> | ||
| # actions/download-artifact@v4 unzips a single-file artifact into a directory | ||
| # named after the artifact, preserving the source file's basename. | ||
| # Copy each back to its expected location so coverage-baselines.json's | ||
| # summaryPath entries resolve. | ||
| declare -A targets=( | ||
| [packages-api]=packages/api/coverage/unit/coverage-summary.json | ||
| [apps-expo]=apps/expo/coverage/unit/coverage-summary.json | ||
| [packages-mcp]=packages/mcp/coverage/coverage-summary.json | ||
| [packages-analytics]=packages/analytics/coverage/coverage-summary.json | ||
| [packages-overpass]=packages/overpass/coverage/coverage-summary.json | ||
| [packages-units]=packages/units/coverage/coverage-summary.json | ||
| ) | ||
| for slug in "${!targets[@]}"; do | ||
| target="${targets[$slug]}" | ||
| src_dir="artifacts/coverage-summary-${slug}" | ||
| if [ ! -d "$src_dir" ]; then | ||
| echo "::warning::missing artifact for $slug — coverage job may have failed" | ||
| continue | ||
| fi | ||
| mkdir -p "$(dirname "$target")" | ||
| # Find the single JSON file inside (path may be flat or preserved). | ||
| src_file=$(find "$src_dir" -name 'coverage-summary.json' | head -n1) | ||
| if [ -z "$src_file" ]; then | ||
| echo "::warning::no coverage-summary.json inside artifacts/coverage-summary-${slug}" | ||
| continue | ||
| fi | ||
| cp "$src_file" "$target" | ||
| echo "restored $slug → $target" | ||
| done | ||
|
|
||
| - name: Run coverage ratchet | ||
| run: bun check:coverage | ||
|
|
||
| # On a green push to main, auto-bump coverage-baselines.json upward. | ||
| # Never runs on PRs — PRs cannot edit the baseline file silently. | ||
| bump-baseline: | ||
| name: Bump Coverage Baselines | ||
| runs-on: ubuntu-latest | ||
| needs: ratchet | ||
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| # Need full token to push the auto-commit back to main. | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: latest | ||
|
|
||
| - name: Install dependencies | ||
| env: | ||
| PACKRAT_NATIVEWIND_UI_GITHUB_TOKEN: ${{ secrets.PACKRAT_NATIVEWIND_UI_GITHUB_TOKEN }} | ||
| run: bun install --frozen-lockfile | ||
|
|
||
| - name: Download all coverage summaries | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: coverage-summary-* | ||
| path: artifacts | ||
|
|
||
| - name: Restore summaries to their workspace paths | ||
| run: | | ||
| set -euo pipefail | ||
| declare -A targets=( | ||
| [packages-api]=packages/api/coverage/unit/coverage-summary.json | ||
| [apps-expo]=apps/expo/coverage/unit/coverage-summary.json | ||
| [packages-mcp]=packages/mcp/coverage/coverage-summary.json | ||
| [packages-analytics]=packages/analytics/coverage/coverage-summary.json | ||
| [packages-overpass]=packages/overpass/coverage/coverage-summary.json | ||
| [packages-units]=packages/units/coverage/coverage-summary.json | ||
| ) | ||
| for slug in "${!targets[@]}"; do | ||
| target="${targets[$slug]}" | ||
| src_dir="artifacts/coverage-summary-${slug}" | ||
| if [ ! -d "$src_dir" ]; then | ||
| continue | ||
| fi | ||
| mkdir -p "$(dirname "$target")" | ||
| src_file=$(find "$src_dir" -name 'coverage-summary.json' | head -n1) | ||
| if [ -n "$src_file" ]; then | ||
| cp "$src_file" "$target" | ||
| fi | ||
| done | ||
|
|
||
| - name: Compute baseline updates | ||
| run: bun check:coverage:update | ||
|
|
||
| - name: Commit baseline updates | ||
| uses: stefanzweifel/git-auto-commit-action@v6 | ||
| with: | ||
| commit_message: "chore(coverage): bump baselines after green main" | ||
| file_pattern: coverage-baselines.json | ||
|
|
||
| # The scripts test suite — verifies the ratchet and assertion-lint analyzers | ||
| # themselves on every PR that touches them or their tests. | ||
| scripts-tests: | ||
| name: Scripts Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: latest | ||
| - name: Install dependencies | ||
| env: | ||
| PACKRAT_NATIVEWIND_UI_GITHUB_TOKEN: ${{ secrets.PACKRAT_NATIVEWIND_UI_GITHUB_TOKEN }} | ||
| run: bun install --frozen-lockfile | ||
| - name: Run scripts test suite | ||
| run: bun test:scripts | ||
|
Comment on lines
+109
to
+280
Contributor
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. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Fetch latest commit SHAs for the action versions currently in use
echo "actions/checkout@v6:"
gh api repos/actions/checkout/commits/refs/tags/v6 --jq '.sha'
echo "oven-sh/setup-bun@v2:"
gh api repos/oven-sh/setup-bun/commits/refs/tags/v2 --jq '.sha'
echo "davelosert/vitest-coverage-report-action@v2:"
gh api repos/davelosert/vitest-coverage-report-action/commits/refs/tags/v2 --jq '.sha'
echo "actions/upload-artifact@v4:"
gh api repos/actions/upload-artifact/commits/refs/tags/v4 --jq '.sha'
echo "actions/download-artifact@v4:"
gh api repos/actions/download-artifact/commits/refs/tags/v4 --jq '.sha'
echo "stefanzweifel/git-auto-commit-action@v6:"
gh api repos/stefanzweifel/git-auto-commit-action/commits/refs/tags/v6 --jq '.sha'Repository: PackRat-AI/PackRat Length of output: 495 Pin GitHub Actions in All
🧰 Tools🪛 zizmor (1.25.2)[warning] 109-109: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [warning] 150-150: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [warning] 212-215: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [warning] 271-271: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [warning] 121-121: code injection via template expansion (template-injection): may expand into attacker-controllable code (template-injection) [error] 109-109: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 111-111: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 125-125: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 135-135: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 150-150: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 152-152: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 162-162: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 212-212: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 217-217: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 227-227: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 260-260: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 271-271: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 272-272: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [info] 260-260: action functionality is already included by the runner (superfluous-actions): use (superfluous-actions) 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,9 @@ on: | |
| required: false | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| update: | ||
| name: Publish EAS Update | ||
|
|
||
This file was deleted.
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.
Scope permissions to jobs, not workflow-level.
Workflow-level
contents: writeandpull-requests: writegrant excessive permissions to all jobs. Onlybump-baselineneedscontents: write(and only on main), and onlycoverageneedspull-requests: write(for PR comments). Thescripts-testsandratchetjobs don't need write permissions at all.🔒 Recommended fix: move permissions to job level
ratchet: name: Coverage Ratchet runs-on: ubuntu-latest + permissions: + contents: read needs: coveragebump-baseline: name: Bump Coverage Baselines runs-on: ubuntu-latest + permissions: + contents: write # for git-auto-commit-action needs: ratchetscripts-tests: name: Scripts Tests runs-on: ubuntu-latest + permissions: + contents: read steps:As per coding guidelines: minimize permissions scope to reduce supply-chain attack surface.
📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.25.2)
[error] 37-37: overly broad permissions (excessive-permissions): contents: write is overly broad at the workflow level
(excessive-permissions)
[error] 38-38: overly broad permissions (excessive-permissions): pull-requests: write is overly broad at the workflow level
(excessive-permissions)
🤖 Prompt for AI Agents