From 89d1826a6b6225fe8d8de20befb09581be9e5c58 Mon Sep 17 00:00:00 2001 From: EhsanAzish80 Date: Fri, 4 Dec 2026 15:21:09 +0300 Subject: [PATCH 1/2] Prepare Action 1.3.0 with published CLI onboarding and demo checks --- .github/workflows/example-advanced.yml | 26 +-- .github/workflows/example-basic.yml | 4 +- .github/workflows/example-monorepo.yml | 14 +- .github/workflows/test.yml | 16 +- CHANGELOG.md | 6 +- README.md | 233 +++++++++++-------------- action.yml | 4 +- examples/pr-comparison.yml | 7 +- examples/review.yml | 11 +- scripts/comment.cjs | 4 +- tests/comment.test.cjs | 10 +- 11 files changed, 166 insertions(+), 169 deletions(-) diff --git a/.github/workflows/example-advanced.yml b/.github/workflows/example-advanced.yml index 990dda3..7e4e807 100644 --- a/.github/workflows/example-advanced.yml +++ b/.github/workflows/example-advanced.yml @@ -28,29 +28,33 @@ jobs: - name: Run Devscope id: devscope - uses: EhsanAzish80/devscope-action@v1 + uses: EhsanAzish80/devscope-action@v1.3.0 with: + devscope-version: '0.3.0' + # Optional absolute gate; start with advisory review before choosing policy. fail-under: B max-risk: Medium max-onboarding: Moderate - name: Report metrics run: | - echo "### ๐Ÿ“Š Code Health Metrics" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "- **Grade:** ${{ steps.devscope.outputs.grade }}" >> $GITHUB_STEP_SUMMARY - echo "- **Risk:** ${{ steps.devscope.outputs.risk }}" >> $GITHUB_STEP_SUMMARY - echo "- **Onboarding:** ${{ steps.devscope.outputs.onboarding }}" >> $GITHUB_STEP_SUMMARY - echo "- **Health Score:** ${{ steps.devscope.outputs.health }}/100" >> $GITHUB_STEP_SUMMARY + { + echo "### ๐Ÿ“Š Code Health Metrics" + echo "" + echo "- **Grade:** ${{ steps.devscope.outputs.grade }}" + echo "- **Risk:** ${{ steps.devscope.outputs.risk }}" + echo "- **Onboarding:** ${{ steps.devscope.outputs.onboarding }}" + echo "- **Health Score:** ${{ steps.devscope.outputs.health }}/100" + } >> "$GITHUB_STEP_SUMMARY" notify: - name: Notify on Grade Change + name: Inspect a Low Heuristic Grade needs: health-check runs-on: ubuntu-latest - if: needs.health-check.outputs.grade == 'F' + if: always() && needs.health-check.outputs.grade == 'F' steps: - name: Alert on critical health run: | - echo "::error::Code health is critical (Grade: F)" - echo "Immediate action required to improve maintainability" + echo "Heuristic grade F: inspect the component scores and project policy" + echo "The grade is a review signal, not proof of defects" diff --git a/.github/workflows/example-basic.yml b/.github/workflows/example-basic.yml index 4b13deb..ef1b8e7 100644 --- a/.github/workflows/example-basic.yml +++ b/.github/workflows/example-basic.yml @@ -23,7 +23,9 @@ jobs: fetch-depth: 0 # Full history for accurate git metrics - name: Run Devscope - uses: EhsanAzish80/devscope-action@v1 + uses: EhsanAzish80/devscope-action@v1.3.0 with: + devscope-version: '0.3.0' + # Optional absolute gate; start with advisory review before choosing policy. fail-under: B max-risk: Medium diff --git a/.github/workflows/example-monorepo.yml b/.github/workflows/example-monorepo.yml index 7c7b96a..438a7cc 100644 --- a/.github/workflows/example-monorepo.yml +++ b/.github/workflows/example-monorepo.yml @@ -30,19 +30,23 @@ jobs: fetch-depth: 0 - name: Analyze ${{ matrix.service }} - uses: EhsanAzish80/devscope-action@v1 + uses: EhsanAzish80/devscope-action@v1.3.0 id: devscope with: path: ./services/${{ matrix.service }} + devscope-version: '0.3.0' + # Optional absolute gate; start with advisory review before choosing policy. fail-under: C max-risk: High - name: Report ${{ matrix.service }} metrics run: | - echo "## ${{ matrix.service }}" >> $GITHUB_STEP_SUMMARY - echo "Grade: ${{ steps.devscope.outputs.grade }}" >> $GITHUB_STEP_SUMMARY - echo "Risk: ${{ steps.devscope.outputs.risk }}" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY + { + echo "## ${{ matrix.service }}" + echo "Grade: ${{ steps.devscope.outputs.grade }}" + echo "Risk: ${{ steps.devscope.outputs.risk }}" + echo "" + } >> "$GITHUB_STEP_SUMMARY" aggregate: name: Aggregate Results diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cbed2d8..908da5c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -89,7 +89,6 @@ jobs: id: comparison with: compare: 'true' - devscope-ref: d9849fddd644f98a67985115af74c74ff0a5230e - name: Verify comparison report if: github.event_name == 'pull_request' @@ -105,7 +104,6 @@ jobs: with: review: 'true' fail-on-new: 'true' - devscope-ref: 68c1fa668de53f71920e263bbb1f2325cb5f44d0 - name: Verify advanced reports and real CLI regression gate if: github.event_name == 'pull_request' @@ -133,6 +131,20 @@ jobs: assert json.loads(output.read_text(encoding='utf-8'))['new_warnings'] == 1 PY + - name: Verify published CLI first-run demo + shell: bash + run: | + python - <<'PY' + import json, os, pathlib, subprocess + env = {**os.environ, 'PYTHONIOENCODING': 'ascii'} + result = subprocess.run(['devscope', 'demo'], check=True, capture_output=True, text=True, encoding='ascii', env=env) + assert 'Synthetic sample' in result.stdout and 'billing/service.py' in result.stdout + data = json.loads(subprocess.check_output(['devscope', 'demo', '--format', 'json'], text=True)) + assert data['demo'] is True + subprocess.run(['devscope', 'demo', '--format', 'html', '--output', 'first-run-demo.html'], check=True) + assert 'SYNTHETIC DEMO' in pathlib.Path('first-run-demo.html').read_text(encoding='utf-8') + PY + - name: Report test results if: always() shell: bash diff --git a/CHANGELOG.md b/CHANGELOG.md index bb1e00a..3811296 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,13 @@ -# Development: advanced review +# 1.3.0 โ€” 2026-12-04 - Opt-in review checklists, history evidence and package scopes. - New-warning gates that retain reports before failing. - Coverage input and exact-head provenance assertion. - HTML/JSON/Markdown artifacts and structured outputs. - Validated review options, bounded summaries and cross-platform integration tests. -- Development default CLI version moves to published 0.2.0; advanced review uses a source pin until 0.3.0 is released. +- CLI 0.3.0 is the default; examples use released packages and versioned Action tags. +- Advisory-first visual onboarding, actual screenshots and readable scan-time formatting. +- Published-package CI covers the guided demo, including ASCII-only consoles. ## 1.2.0 โ€” 2026-12-04 diff --git a/README.md b/README.md index 7062adc..ef36a68 100644 --- a/README.md +++ b/README.md @@ -1,168 +1,135 @@ # Devscope Action -Run [Devscope](https://github.com/EhsanAzish80/Devscope) in GitHub Actions. It reports a heuristic repository grade, risk and onboarding labels, and can fail a job when a configured threshold is missed. +**Give reviewers a useful place to start.** -## Quick start +Add an evidence-led checklist to each PR: changed files, history, co-change +signals and optional patch coverage. Share an updated comment plus offline +HTML, JSON and Markdown reports. Start advisory; choose blocking gates later. -```yaml -name: Codebase review -on: [pull_request, push] -permissions: - contents: read - pull-requests: write -jobs: - devscope: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: EhsanAzish80/devscope-action@v1.2.0 - id: devscope - with: - fail-under: B - devscope-version: '0.2.0' -``` +[![Tests](https://github.com/EhsanAzish80/devscope-action/actions/workflows/test.yml/badge.svg)](https://github.com/EhsanAzish80/devscope-action/actions/workflows/test.yml) -Action 1.2.0 is released and is also available through `@v1`. By default, the Action installs the published PyPI package. Results are available as `health`, `risk`, `onboarding`, and `grade` outputs. It posts one updated PR comment when the workflow token has write permission. PRs from forks often receive a read-only token; in that case the comment is skipped and the analysis and threshold check still run. +![Actual Devscope report on the integration PR](https://raw.githubusercontent.com/EhsanAzish80/Devscope/main/docs/assets/pr-comment.jpg) -## Inputs - -| Input | Default | Meaning | -| --- | --- | --- | -| `path` | `.` | Directory to analyze | -| `fail-under` | unset | Lowest accepted grade, A through F | -| `max-risk` | unset | Highest accepted risk label: Low, Medium, High | -| `max-onboarding` | unset | Highest accepted onboarding label: Easy, Moderate, Hard | -| `github-token` | `github.token` | Token for PR comments | -| `devscope-version` | `0.2.0` | Published PyPI version to install | -| `devscope-ref` | unset | Full upstream CLI commit SHA to install instead of the PyPI version | -| `compare` | `false` | Add an advisory comparison on `pull_request` events | -| `review` | `false` | Advanced checklist, history, new-warning gate and report artifacts | -| `fail-on-new` | `false` | Fail for new review warnings; requires `review: true` | -| `package` | unset | One repository-relative package scope for review | -| `coverage` | unset | LCOV or Cobertura report path, generated before this step | -| `coverage-commit` | unset | Coverage producer's commit; must match the PR head | -| `coverage-root` | unset | Original repository-root prefix in coverage paths | -| `artifact-name` | `devscope-review` | Review artifact name prefix (OS is appended) | - -When a threshold is set, it applies to **both pull requests and pushes**. Analysis errors fail the job instead of producing a default grade. The grade is based on file layout, test-file ratio, Git activity, and hotspots. The test-file ratio is not code coverage. Read [the CLI guide](https://github.com/EhsanAzish80/Devscope#what-the-report-tells-you) before using a grade as a gate. - -For a fork PR, do not switch to `pull_request_target` and execute untrusted code with a write token. If comments are essential, use a separate privileged workflow that reads an artifact from the unprivileged analysis job. +[See the actual comment](https://github.com/EhsanAzish80/devscope-action/pull/3#issuecomment-7410424486) +ยท [Try the CLI demo](https://github.com/EhsanAzish80/Devscope#devscope) -## PR comparison +## Add it to a repository -Save this as `.github/workflows/devscope.yml`, or copy the complete -[example workflow](examples/pr-comparison.yml). It uses the released comparison engine. +Save as `.github/workflows/devscope.yml`. This example reports findings without +blocking a merge based on new warnings. ```yaml -name: Devscope PR comparison +name: Devscope review on: pull_request permissions: contents: read pull-requests: write jobs: - devscope: + review: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - - uses: EhsanAzish80/devscope-action@v1.2.0 - id: devscope + fetch-depth: 0 + - uses: EhsanAzish80/devscope-action@v1.3.0 with: - compare: 'true' - devscope-version: '0.2.0' + review: 'true' + devscope-version: '0.3.0' ``` -The report includes count deltas and added, removed or changed review areas from -`merge-base(base.sha, head.sha)` to the PR head. It appears in both the job summary -and the existing bot comment. Positive deltas mean larger counts, not improvements; -removed review areas do not prove that a defect was fixed. The comparison is -advisory; the existing grade/risk/onboarding thresholds remain absolute gates. +Action 1.3.0 uses CLI 0.3.0 by default; the explicit version keeps your workflow +reproducible. `@v1` follows the latest compatible Action release. Prefer the +versioned tag when you want deliberate upgrades. + +[Copy the complete review workflow](examples/review.yml). +Only need compact count deltas? Use the [comparison workflow](examples/pr-comparison.yml). +For a job summary with no comment permission, use the [CLI-only workflow](https://github.com/EhsanAzish80/Devscope/blob/main/examples/pr-comparison.yml). + +## Read the result -`compare` defaults to `false` and is skipped outside pull requests. When enabled: +- **PR comment:** one bot report is updated on each run. Read-only tokens skip + the comment while retaining the job summary and report artifacts. +- **Offline report:** download the `devscope-review-` artifact from the job, + then open `review.html`. It includes filtering and complete structured data. +- **Evidence:** size/churn are review heuristics. Coverage is imported from a + supplied report; test-file counts do not establish coverage or passing tests. -- Use CLI 0.2.0 or newer for comparison. The released Action 1.2.0 retains its - older 0.1.1 default; set `devscope-version` as shown. The development Action - defaults to 0.2.0. -- Check out the exact PR head with full history. Both event SHAs must be available. - Shallow or missing history fails the comparison with a setup message. -- Set `path` to the Git repository root. Subdirectory comparisons are not supported. -- Read-only fork tokens skip the comment but retain the job summary. For summary - only on all PRs, use the [CLI-only workflow](https://github.com/EhsanAzish80/Devscope/blob/main/examples/pr-comparison.yml). +![Offline demo report; all sample data is synthetic](https://raw.githubusercontent.com/EhsanAzish80/Devscope/main/docs/assets/html-report.jpg) -The `comparison-report` output is the local Markdown report path, available to -later steps in the same job. It is empty when comparison is disabled or skipped. -Long comments are truncated with a pointer to the full job summary. Git activity, -symlinks, submodules and Git archive export-ignored files are excluded. +[Download the labelled sample HTML](https://github.com/EhsanAzish80/Devscope/releases/download/v0.3.0/devscope-demo.html) -## Advanced review (development) +## Enable a new-warning gate when ready -Advanced review requires the 0.3.0 CLI source and this development Action; it is -not included in the released Action 1.2.0 or CLI 0.2.0. The complete -[review workflow](examples/review.yml) uses exact source pins: +Commit `.devscope.json` and, optionally, `.devscope-baseline.json` on the target +branch. Add `fail-on-new: 'true'` alongside `review: 'true'`. Existing and accepted +findings do not fail this gate. Reports and artifacts are produced before it +returns a failure, so reviewers can inspect the evidence. + +Both snapshots use the target commit's policy and baseline; a PR cannot weaken +its own gate by editing them, `.gitignore` or archive attributes. Initial warning +rules are large non-test source files and zero-hit added executable lines in +supplied coverage. Absolute grade/risk/onboarding gates are separate and opt-in. + +[Configuration, baselines and monorepos](https://github.com/EhsanAzish80/Devscope/blob/main/docs/guide.md) + +## Add measured coverage + +Generate LCOV or Cobertura coverage for the exact checked-out PR head in an +earlier step. Then add these inputs: ```yaml -name: Devscope review guidance -on: pull_request -permissions: - contents: read - pull-requests: write -jobs: - review: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - # Source pins until the advanced Action and CLI are released. - - uses: EhsanAzish80/devscope-action@2c2f8f7d7e9d873057708bc6bb42e9c49c840dc9 - with: - devscope-ref: 68c1fa668de53f71920e263bbb1f2325cb5f44d0 - review: 'true' - fail-on-new: 'true' - # After generating coverage in an earlier step, optionally add: - # coverage: coverage.info - # coverage-commit: ${{ github.event.pull_request.head.sha }} +coverage: coverage.info +coverage-commit: ${{ github.event.pull_request.head.sha }} ``` -Review mode supersedes the basic comparison when both flags are enabled. It adds: - -- A changed-file checklist with exact-commit source links, target-history counts, - co-change suggestions and evidence for each warning. -- Repo-wide history hotspots, package summaries, and optional measured patch coverage. -- HTML, JSON and Markdown artifacts retained for 7 days. Download `review.html` - for the self-contained, filterable offline report. The OS is appended to the - artifact name; set a different `artifact-name` for repeated uses in one job. -- `review-html`, `review-json` and `new-warnings` outputs, alongside the existing - `comparison-report` Markdown path. - -Commit `.devscope.json` and an optional `.devscope-baseline.json` on the target -branch. Both snapshots use target policy, so a PR cannot disable its own gate. -`fail-on-new` is opt-in and only blocks new configured warnings; it does not -block existing or accepted warnings. Invalid Boolean values and review-only -options without `review: true` fail setup. The report and artifacts are produced -before a new-warning gate failure, allowing reviewers to inspect the evidence. -Absolute grade/risk/onboarding gates remain separate. - -Generate coverage for the exact PR head before invoking the Action. When setting -`coverage`, also set `coverage-commit` to that SHA. This is a caller assertion, -not independent verification of freshness. Lines absent from the report remain -unmapped/unknown, not automatically uncovered. The initial warning rules are -configurable large source files and zero-hit added executable lines in supplied -coverage. Size, churn and co-change signals remain heuristics. - -Configuration, baseline identity, package scopes, coverage mapping and onboarding -commands are explained in the [CLI feature guide](https://github.com/EhsanAzish80/Devscope/blob/68c1fa668de53f71920e263bbb1f2325cb5f44d0/README.md#review-guidance-030-development). -For repository exploration use `devscope onboard`; it displays declared commands -without executing them. Reports contain paths and metadata, not source code. +The commit is a caller-supplied provenance assertion, not independent proof of +freshness. Lines absent from the report remain unmapped/unknown. Use `coverage-root` +when the report records absolute paths from another machine. -## Development +## Inputs + +| Input | Default | Purpose | +| --- | --- | --- | +| `path` | `.` | Directory to scan; review/compare require the repository root | +| `review` | `false` | PR checklist, history evidence and report artifacts | +| `compare` | `false` | Compact PR count comparison; review supersedes it when both are enabled | +| `devscope-version` | `0.3.0` | Published CLI package version | +| `devscope-ref` | unset | Advanced override: full upstream CLI commit SHA | +| `fail-on-new` | `false` | Block new configured review warnings; requires review mode | +| `package` | unset | Repository-relative package scope; requires review mode | +| `coverage` | unset | LCOV/Cobertura report path; requires review mode | +| `coverage-commit` | unset | Report producer's commit; must match reviewed head | +| `coverage-root` | unset | Original repository-root prefix in coverage paths | +| `artifact-name` | `devscope-review` | Artifact prefix; OS is appended; change for repeated uses in one job | +| `fail-under` | unset | Absolute minimum heuristic grade, Aโ€“F | +| `max-risk` | unset | Absolute maximum label: Low, Medium, High | +| `max-onboarding` | unset | Absolute maximum label: Easy, Moderate, Hard | +| `github-token` | `github.token` | Token for the optional PR comment | + +Review/comparison run on `pull_request` events; absolute thresholds apply on both +PRs and pushes. Boolean inputs accept `true` or `false`. Coverage/package inputs +and `fail-on-new` require review mode. Missing history or analysis errors fail +setup instead of producing a default grade. + +## Outputs + +| Output | Value | +| --- | --- | +| `comparison-report` | Local Markdown report path, empty when reporting is skipped | +| `review-html`, `review-json` | Local advanced report paths | +| `new-warnings` | New warning count, empty outside review mode | +| `health`, `grade`, `risk`, `onboarding` | Working-tree heuristic summary fields | + +Reports are available to later steps in the same job; advanced artifacts are +retained for 7 days. Long comments/summaries point to complete report files. +Reviews use committed snapshots; working-tree health metrics can also include +files generated by earlier steps. No repository commands are executed by review. + +For fork PR comments, retain the normal unprivileged PR workflow. Do not switch +to `pull_request_target` to execute an untrusted checkout with a write token. -Run the shell integration checks locally: +## Development ```bash bash tests/test-action.sh @@ -170,6 +137,8 @@ python3 -m unittest discover -s tests -p 'test_*.py' node --test tests/comment.test.cjs ``` -Released Action 1.2.0 is available via `@v1`; CLI 0.2.0 is on PyPI. Advanced review remains source-only pending review and release. CI tests comparison, advanced report artifacts, permissive gates and a real new-warning regression gate on Ubuntu, macOS and Windows. +CI tests the published CLI on Ubuntu, macOS and Windows, including artifacts, +permissive gates, a real regression gate and the first-run demo. CLI 0.3.0 and +Action 1.3.0 replace the source pins needed during development. MIT licensed. See [LICENSE](LICENSE). diff --git a/action.yml b/action.yml index 91748c3..4b7d32c 100644 --- a/action.yml +++ b/action.yml @@ -30,7 +30,7 @@ inputs: devscope-version: description: 'PyPI version of devscope to install' required: false - default: '0.2.0' + default: '0.3.0' devscope-ref: description: 'Optional full commit SHA from EhsanAzish80/Devscope; overrides devscope-version' required: false @@ -40,7 +40,7 @@ inputs: required: false default: 'false' review: - description: 'Enable history-aware review guidance and HTML/JSON artifacts on pull requests (requires CLI 0.3.0 or matching source ref)' + description: 'Enable history-aware review guidance and HTML/JSON artifacts on pull requests (CLI 0.3.0+)' required: false default: 'false' fail-on-new: diff --git a/examples/pr-comparison.yml b/examples/pr-comparison.yml index b8b0cb0..66df370 100644 --- a/examples/pr-comparison.yml +++ b/examples/pr-comparison.yml @@ -4,15 +4,14 @@ permissions: contents: read pull-requests: write jobs: - devscope: + compare: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - - uses: EhsanAzish80/devscope-action@v1.2.0 - id: devscope + - uses: EhsanAzish80/devscope-action@v1.3.0 with: compare: 'true' - devscope-version: '0.2.0' + devscope-version: '0.3.0' diff --git a/examples/review.yml b/examples/review.yml index dfd305d..1372d18 100644 --- a/examples/review.yml +++ b/examples/review.yml @@ -1,4 +1,4 @@ -name: Devscope review guidance +name: Devscope review on: pull_request permissions: contents: read @@ -11,12 +11,7 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 - # Source pins until the advanced Action and CLI are released. - - uses: EhsanAzish80/devscope-action@2c2f8f7d7e9d873057708bc6bb42e9c49c840dc9 + - uses: EhsanAzish80/devscope-action@v1.3.0 with: - devscope-ref: 68c1fa668de53f71920e263bbb1f2325cb5f44d0 review: 'true' - fail-on-new: 'true' - # After generating coverage in an earlier step, optionally add: - # coverage: coverage.info - # coverage-commit: ${{ github.event.pull_request.head.sha }} + devscope-version: '0.3.0' diff --git a/scripts/comment.cjs b/scripts/comment.cjs index ebe18d7..8b43316 100644 --- a/scripts/comment.cjs +++ b/scripts/comment.cjs @@ -2,13 +2,15 @@ const fs = require('node:fs'); module.exports = async function postComment({ github, context, core }) { const env = process.env; + const seconds = Number(env.DEVSCOPE_SCAN_TIME); + const scanTime = env.DEVSCOPE_SCAN_TIME && Number.isFinite(seconds) ? `${seconds.toFixed(2)}s` : 'unavailable'; const marker = ''; let comparison = env.DEVSCOPE_COMPARISON_REPORT ? fs.readFileSync(env.DEVSCOPE_COMPARISON_REPORT, 'utf8') : ''; if (comparison.length > 50000) { comparison = comparison.slice(0, 50000) + '\n\n_Comparison truncated; see the full job summary._'; } - const body = `${marker}\n## Devscope Report\n\n**Heuristic grade:** ${env.DEVSCOPE_GRADE} \n**Risk:** ${env.DEVSCOPE_RISK} \n**Onboarding:** ${env.DEVSCOPE_ONBOARDING} \n**Scan time:** ${env.DEVSCOPE_SCAN_TIME}s\n\n${env.DEVSCOPE_COMPACT}${comparison ? '\n\n' + comparison : ''}`; + const body = `${marker}\n## Devscope Report\n\n**Heuristic grade:** ${env.DEVSCOPE_GRADE} \n**Risk:** ${env.DEVSCOPE_RISK} \n**Onboarding:** ${env.DEVSCOPE_ONBOARDING} \n**Scan time:** ${scanTime}\n\n${env.DEVSCOPE_COMPACT}${comparison ? '\n\n' + comparison : ''}`; try { const comments = await github.paginate(github.rest.issues.listComments, { ...context.repo, issue_number: context.issue.number, diff --git a/tests/comment.test.cjs b/tests/comment.test.cjs index 73e3a2f..907717d 100644 --- a/tests/comment.test.cjs +++ b/tests/comment.test.cjs @@ -5,7 +5,7 @@ const os = require('node:os'); const path = require('node:path'); const postComment = require('../scripts/comment.cjs'); let directory; -const keys = ['DEVSCOPE_GRADE', 'DEVSCOPE_COMPACT', 'DEVSCOPE_COMPARISON_REPORT']; +const keys = ['DEVSCOPE_GRADE', 'DEVSCOPE_COMPACT', 'DEVSCOPE_COMPARISON_REPORT', 'DEVSCOPE_SCAN_TIME']; let saved; beforeEach(() => { saved = Object.fromEntries(keys.map(key => [key, process.env[key]])); @@ -79,3 +79,11 @@ test('large comparisons fit comment limits and point to the full summary', async assert.ok(api.calls.created[0].body.length < 60000); assert.ok(api.calls.created[0].body.includes('full job summary')); }); + +test('scan time is rounded for readable comments', async () => { + process.env.DEVSCOPE_SCAN_TIME = '0.01206064224243164'; + const api = client(); + await postComment(api); + assert.ok(api.calls.created[0].body.includes('**Scan time:** 0.01s')); + assert.ok(!api.calls.created[0].body.includes('0.01206064224243164')); +}); From 73d85f0c924ebd1483f57abf4eac4271d1f93814 Mon Sep 17 00:00:00 2001 From: EhsanAzish80 Date: Fri, 4 Dec 2026 15:26:42 +0300 Subject: [PATCH 2/2] Refresh package installs and complete each platform check independently --- .github/workflows/test.yml | 1 + action.yml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 908da5c..602be5a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,7 @@ jobs: name: Test Devscope Action runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] diff --git a/action.yml b/action.yml index 4b7d32c..bff7726 100644 --- a/action.yml +++ b/action.yml @@ -123,9 +123,9 @@ runs: echo 'devscope-ref must be a full 40-character commit SHA' >&2 exit 1 fi - python -m pip install --disable-pip-version-check "devscope @ git+https://github.com/EhsanAzish80/Devscope.git@$DEVSCOPE_REF" + python -m pip install --no-cache-dir --disable-pip-version-check "devscope @ git+https://github.com/EhsanAzish80/Devscope.git@$DEVSCOPE_REF" else - python -m pip install --disable-pip-version-check "devscope==$DEVSCOPE_VERSION" + python -m pip install --no-cache-dir --disable-pip-version-check "devscope==$DEVSCOPE_VERSION" fi - name: Run analysis