-
Notifications
You must be signed in to change notification settings - Fork 2
Reference implmentation #20
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
6a1804f
e56e12e
aaab19a
a10846e
0f89c38
fe80acb
feffc8d
3239612
81d36d2
d71a65b
3596e9d
5297e9c
3797580
b74f430
41d3a03
1140f72
e8a086e
348490d
863ce81
c24be79
8590b75
3d5a777
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,11 @@ | ||
| # To get started with Dependabot version updates, you'll need to specify which | ||
| # package ecosystems to update and where the package manifests are located. | ||
| # Please see the documentation for all configuration options: | ||
| # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
|
||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "" # See documentation for possible values | ||
| directory: "/" # Location of package manifests | ||
| schedule: | ||
| interval: "weekly" |
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,24 +1,121 @@ | |||||||||||||||||||||||
| name: Build | |||||||||||||||||||||||
| name: Build and Test | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| on: | |||||||||||||||||||||||
| push: | |||||||||||||||||||||||
| branches: | |||||||||||||||||||||||
| - '**' | |||||||||||||||||||||||
| pull_request: | |||||||||||||||||||||||
| branches: | |||||||||||||||||||||||
| - '**' | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||
| testing: | |||||||||||||||||||||||
| test: | |||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| strategy: | |||||||||||||||||||||||
| matrix: | |||||||||||||||||||||||
| node-version: [20.19.0, 21.x, 22.x, 23.x] | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| steps: | |||||||||||||||||||||||
| - name: Checkout code | |||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Setup Node.js ${{ matrix.node-version }} | |||||||||||||||||||||||
| uses: actions/setup-node@v4 | |||||||||||||||||||||||
| with: | |||||||||||||||||||||||
| node-version: ${{ matrix.node-version }} | |||||||||||||||||||||||
| cache: "npm" | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||
| run: npm ci | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Build project | |||||||||||||||||||||||
| run: npm run build | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Run tests | |||||||||||||||||||||||
| run: npm test | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Test CLI - Merge | |||||||||||||||||||||||
| run: node dist/cli.js merge test-reports | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Test CLI - Validate | |||||||||||||||||||||||
| run: node dist/cli.js validate examples/minimal.json | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Test CLI - Validate Strict | |||||||||||||||||||||||
| run: node dist/cli.js validate-strict examples/minimal.json | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Test CLI - Flaky | |||||||||||||||||||||||
| run: node dist/cli.js flaky examples/with-retries.json | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Test CLI - Generate Test IDs | |||||||||||||||||||||||
| run: node dist/cli.js generate-test-ids examples/minimal.json | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Test CLI - Generate Report ID | |||||||||||||||||||||||
| run: node dist/cli.js generate-report-id examples/minimal.json | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Test CLI - Add Insights | |||||||||||||||||||||||
| run: node dist/cli.js add-insights examples/minimal.json examples | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Publish Test Report | |||||||||||||||||||||||
| uses: ctrf-io/github-test-reporter@v1 | |||||||||||||||||||||||
| with: | |||||||||||||||||||||||
| report-path: "./ctrf/*.json" | |||||||||||||||||||||||
| summary-delta-report: true | |||||||||||||||||||||||
| github-report: true | |||||||||||||||||||||||
| failed-report: true | |||||||||||||||||||||||
| flaky-report: true | |||||||||||||||||||||||
| insights-report: true | |||||||||||||||||||||||
| fail-rate-report: true | |||||||||||||||||||||||
| flaky-rate-report: true | |||||||||||||||||||||||
| slowest-report: true | |||||||||||||||||||||||
| previous-results-report: true | |||||||||||||||||||||||
| upload-artifact: true | |||||||||||||||||||||||
| artifact-name: ctrf-test-report-${{ matrix.node-version }} | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| env: | |||||||||||||||||||||||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |||||||||||||||||||||||
| if: always() | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| lint: | |||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| steps: | |||||||||||||||||||||||
| - name: Checkout code | |||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Setup Node.js | |||||||||||||||||||||||
| uses: actions/setup-node@v4 | |||||||||||||||||||||||
| with: | |||||||||||||||||||||||
| node-version: "20.19.0" | |||||||||||||||||||||||
| cache: "npm" | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||
| run: npm ci | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Type check | |||||||||||||||||||||||
| run: npx tsc --noEmit | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Run linter | |||||||||||||||||||||||
| run: npm run lint:check | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Check formatting | |||||||||||||||||||||||
| run: npm run format:check | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| security: | |||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| steps: | |||||||||||||||||||||||
| - name: Checkout code | |||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||
| run: npm install | |||||||||||||||||||||||
| - name: Build | |||||||||||||||||||||||
| run: npx tsc | |||||||||||||||||||||||
| - name: Merge | |||||||||||||||||||||||
| run: npx ctrf-cli merge test-reports | |||||||||||||||||||||||
| - name: Flaky | |||||||||||||||||||||||
| run: npx ctrf-cli flaky test-reports/ctrf-report-one.json | |||||||||||||||||||||||
| - name: Checkout code | |||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Setup Node.js | |||||||||||||||||||||||
| uses: actions/setup-node@v4 | |||||||||||||||||||||||
| with: | |||||||||||||||||||||||
| node-version: "20.19.0" | |||||||||||||||||||||||
| cache: "npm" | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||
| run: npm ci | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Run security audit | |||||||||||||||||||||||
| run: npm audit --audit-level=moderate | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Check for known vulnerabilities | |||||||||||||||||||||||
| run: npx audit-ci --moderate | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
|
Comment on lines
+101
to
+121
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 1 day ago In general, the fix is to explicitly declare a The best minimal change here is to add a workflow‑level Concretely:
Suggested changeset
1
.github/workflows/main.yaml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,4 @@ dist | |
| node_modules | ||
| coverage | ||
| ctrf | ||
| .DS_Store | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,4 @@ community-reports/ | |
| .exlintrc.js | ||
| README.md | ||
| docs/ | ||
| CODE_OF_CONDUCT.md | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| # Contributor Covenant Code of Conduct | ||
|
|
||
| ## Our Pledge | ||
|
|
||
| We as members, contributors, and leaders pledge to make participation in our | ||
| community a harassment-free experience for everyone, regardless of age, body | ||
| size, visible or invisible disability, ethnicity, sex characteristics, gender | ||
| identity and expression, level of experience, education, socio-economic status, | ||
| nationality, personal appearance, race, religion, or sexual identity | ||
| and orientation. | ||
|
|
||
| We pledge to act and interact in ways that contribute to an open, welcoming, | ||
| diverse, inclusive, and healthy community. | ||
|
|
||
| ## Our Standards | ||
|
|
||
| Examples of behavior that contributes to a positive environment for our | ||
| community include: | ||
|
|
||
| * Demonstrating empathy and kindness toward other people | ||
| * Being respectful of differing opinions, viewpoints, and experiences | ||
| * Giving and gracefully accepting constructive feedback | ||
| * Accepting responsibility and apologizing to those affected by our mistakes, | ||
| and learning from the experience | ||
| * Focusing on what is best not just for us as individuals, but for the | ||
| overall community | ||
|
|
||
| Examples of unacceptable behavior include: | ||
|
|
||
| * The use of sexualized language or imagery, and sexual attention or | ||
| advances of any kind | ||
| * Trolling, insulting or derogatory comments, and personal or political attacks | ||
| * Public or private harassment | ||
| * Publishing others' private information, such as a physical or email | ||
| address, without their explicit permission | ||
| * Other conduct which could reasonably be considered inappropriate in a | ||
| professional setting | ||
|
|
||
| ## Enforcement Responsibilities | ||
|
|
||
| Community leaders are responsible for clarifying and enforcing our standards of | ||
| acceptable behavior and will take appropriate and fair corrective action in | ||
| response to any behavior that they deem inappropriate, threatening, offensive, | ||
| or harmful. | ||
|
|
||
| Community leaders have the right and responsibility to remove, edit, or reject | ||
| comments, commits, code, wiki edits, issues, and other contributions that are | ||
| not aligned to this Code of Conduct, and will communicate reasons for moderation | ||
| decisions when appropriate. | ||
|
|
||
| ## Scope | ||
|
|
||
| This Code of Conduct applies within all community spaces, and also applies when | ||
| an individual is officially representing the community in public spaces. | ||
| Examples of representing our community include using an official e-mail address, | ||
| posting via an official social media account, or acting as an appointed | ||
| representative at an online or offline event. | ||
|
|
||
| ## Enforcement | ||
|
|
||
| Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
| reported to the community leaders responsible for enforcement at | ||
| Matthew Poulton-White. | ||
| All complaints will be reviewed and investigated promptly and fairly. | ||
|
|
||
| All community leaders are obligated to respect the privacy and security of the | ||
| reporter of any incident. | ||
|
|
||
| ## Enforcement Guidelines | ||
|
|
||
| Community leaders will follow these Community Impact Guidelines in determining | ||
| the consequences for any action they deem in violation of this Code of Conduct: | ||
|
|
||
| ### 1. Correction | ||
|
|
||
| **Community Impact**: Use of inappropriate language or other behavior deemed | ||
| unprofessional or unwelcome in the community. | ||
|
|
||
| **Consequence**: A private, written warning from community leaders, providing | ||
| clarity around the nature of the violation and an explanation of why the | ||
| behavior was inappropriate. A public apology may be requested. | ||
|
|
||
| ### 2. Warning | ||
|
|
||
| **Community Impact**: A violation through a single incident or series | ||
| of actions. | ||
|
|
||
| **Consequence**: A warning with consequences for continued behavior. No | ||
| interaction with the people involved, including unsolicited interaction with | ||
| those enforcing the Code of Conduct, for a specified period of time. This | ||
| includes avoiding interactions in community spaces as well as external channels | ||
| like social media. Violating these terms may lead to a temporary or | ||
| permanent ban. | ||
|
|
||
| ### 3. Temporary Ban | ||
|
|
||
| **Community Impact**: A serious violation of community standards, including | ||
| sustained inappropriate behavior. | ||
|
|
||
| **Consequence**: A temporary ban from any sort of interaction or public | ||
| communication with the community for a specified period of time. No public or | ||
| private interaction with the people involved, including unsolicited interaction | ||
| with those enforcing the Code of Conduct, is allowed during this period. | ||
| Violating these terms may lead to a permanent ban. | ||
|
|
||
| ### 4. Permanent Ban | ||
|
|
||
| **Community Impact**: Demonstrating a pattern of violation of community | ||
| standards, including sustained inappropriate behavior, harassment of an | ||
| individual, or aggression toward or disparagement of classes of individuals. | ||
|
|
||
| **Consequence**: A permanent ban from any sort of public interaction within | ||
| the community. | ||
|
|
||
| ## Attribution | ||
|
|
||
| This Code of Conduct is adapted from the [Contributor Covenant][homepage], | ||
| version 2.0, available at | ||
| https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 1 day ago
To fix this, explicitly define a
permissionsblock so that theGITHUB_TOKENused by jobs has only the minimal required scopes. Thelintandsecurityjobs only read the code and run local commands, socontents: readis sufficient. Thetestjob usesctrf-io/github-test-reporter@v1withgithub-report: trueand similar options; such reporting actions typically need to read PRs and statuses and may need to write a PR comment or summary. A conservative and still least-privilege choice is to give that jobcontents: readandpull-requests: write(enough to post PR comments) while keeping other scopes absent.The single best way with minimal functional change is:
permissions: contents: readso that all jobs default to read-only repository access.testjob with a job-levelpermissionsblock that grantscontents: readandpull-requests: write. This keepslintandsecurityas read-only, and givestestexactly what it likely needs for GitHub reporting.All changes are confined to
.github/workflows/main.yamlby inserting the newpermissionsblocks without altering any existing steps.