Skip to content

Commit 27b102a

Browse files
Documentation updates (#251)
add additional information for github context
1 parent 2b72e34 commit 27b102a

25 files changed

+275
-313
lines changed

README.md

Lines changed: 23 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,29 @@ You can support the project by:
2727

2828
**🧘 Super flexible:** start fast with powerful built-in reports or go fully custom with your own templates
2929

30-
**🤖 Continuous AI:** summarize test results with AI and get explanations of them with contextual insights
30+
**🤖 AI summary:** summarize test results with AI and get explanations of them with contextual insights
3131

3232
**🔌 Framework-agnostic:** works with any testing tool
3333

3434
## Table of Contents
3535

3636
1. [Basic Usage](#basic-usage)
3737
2. [Insights Usage](#insights-usage)
38-
3. [Continuous AI Usage](#continuous-ai-usage)
39-
4. [Pull Request Comment Usage](#pull-request-comment-usage)
40-
5. [Super Flexible Usage](#super-flexible-usage)
41-
6. [Report Showcase](#report-showcase)
42-
7. [Generate a report](#generate-a-report)
43-
8. [Available Inputs](#available-inputs)
44-
9. [Generating an AI Report](#generating-an-ai-report)
45-
10. [Pull Requests](#pull-requests)
46-
11. [Status Checks](#status-checks)
47-
12. [Build Your Own Report](#build-your-own-report)
48-
13. [Customizing Report Order](#customizing-report-order)
49-
14. [Community Reports](#community-reports)
50-
15. [GitHub Token](#github-token)
51-
16. [Storing Artifacts](#storing-artifacts)
52-
17. [Filtering](#filtering)
53-
18. [Integrations](#integrations)
54-
19. [What is CTRF?](#what-is-ctrf)
38+
3. [Pull Request Comment Usage](#pull-request-comment-usage)
39+
4. [Super Flexible Usage](#super-flexible-usage)
40+
5. [Report Showcase](#report-showcase)
41+
6. [Generate a report](#generate-a-report)
42+
7. [Available Inputs](#available-inputs)
43+
8. [Pull Requests](#pull-requests)
44+
9. [Status Checks](#status-checks)
45+
10. [Build Your Own Report](#build-your-own-report)
46+
11. [Customizing Report Order](#customizing-report-order)
47+
12. [Community Reports](#community-reports)
48+
13. [GitHub Token](#github-token)
49+
14. [Storing Artifacts](#storing-artifacts)
50+
15. [Filtering](#filtering)
51+
16. [Integrations](#integrations)
52+
17. [What is CTRF?](#what-is-ctrf)
5553

5654
## Basic Usage
5755

@@ -98,40 +96,6 @@ This will create a job summary with insights on failures, flakiness and test dur
9896
<img src="images/insights.png" alt="GitHub Test Reporter" width="600">
9997
</div>
10098

101-
## Continuous AI Usage
102-
103-
To get started with continuous AI analysis of test results, add the following to your workflow file:
104-
105-
```yaml
106-
- name: Publish Test Report with AI Analysis
107-
uses: ctrf-io/github-test-reporter@v1
108-
with:
109-
report-path: './ctrf/*.json'
110-
ai-summary-report: true
111-
on-fail-only: true
112-
summary: false
113-
pull-request: true
114-
ai: |
115-
{
116-
"provider": "openai",
117-
"model": "gpt-5"
118-
}
119-
if: always()
120-
env:
121-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122-
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
123-
```
124-
125-
Add your AI API key to the repository secrets. Choose from a variety of AI providers and models. See [AI Configuration](#ai-configuration) for more information.
126-
127-
Make sure your GitHub Token has pull request write permission.
128-
129-
This will create a pull request comment with a summary of the AI analysis.
130-
131-
<div align="center">
132-
<img src="images/ai-summary.png" alt="GitHub Test Reporter" width="600">
133-
</div>
134-
13599
## Pull Request Comment Usage
136100

137101
To get started with pull request comments, add the following to your workflow file:
@@ -248,82 +212,12 @@ For more advanced usage, there are several inputs available.
248212
group-by: 'filePath' # Specify grouping for applicable reports (e.g., suite or file path). Default is filePath
249213
always-group-by: false # Force grouping by suite or file path for all reports. Default is false
250214
report-order: 'summary-report,failed-report,flaky-report,skipped-report,test-report' # Comma-separated list of report types to specify the order in which reports should be displayed
251-
ai: '{}' # JSON configuration for AI-powered test analysis. See AI Configuration section below
252215
integrations-config: '{}' # JSON configuration for integrations with other developer tools
253216
if: always()
254217
```
255218

256219
Only `report-path` is required.
257220

258-
## Generating an AI Report
259-
260-
You can generate human-readable AI reports for your failed tests using models
261-
from the leading AI providers. The GitHub Test Reporter now features dedicated
262-
AI-first configuration for seamless integration with continuous AI workflows.
263-
264-
### AI Configuration
265-
266-
Use the `ai` input to configure AI-powered test analysis. Simply provide a JSON object
267-
with the provider and any optional settings:
268-
269-
```yaml
270-
- name: Publish Test Report with AI Analysis
271-
uses: ctrf-io/github-test-reporter@v1
272-
with:
273-
report-path: './ctrf/*.json'
274-
ai-summary-report: true
275-
pull-request: true
276-
ai: |
277-
{
278-
"provider": "openai",
279-
"model": "gpt-4"
280-
}
281-
env:
282-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
283-
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
284-
if: always()
285-
```
286-
287-
### Supported AI Providers
288-
289-
The following AI providers are supported:
290-
291-
- **openai** - OpenAI (GPT-4, GPT-3.5, etc.)
292-
- **claude** - Anthropic Claude
293-
- **gemini** - Google Gemini
294-
- **azure-openai** - Azure OpenAI Service
295-
- **grok** - xAI Grok
296-
- **deepseek** - DeepSeek
297-
- **mistral** - Mistral AI
298-
- **perplexity** - Perplexity AI
299-
- **openrouter** - OpenRouter (access to multiple models)
300-
- **bedrock** - AWS Bedrock (Claude, Llama, Titan, etc.)
301-
- **custom** - Custom OpenAI compatible AI provider, in-house solutions, LocalAI, Ollama, etc, just provide the url
302-
303-
### AI Configuration Options
304-
305-
All configuration parameters are specified at the root level (all optional except `provider`):
306-
307-
```json
308-
{
309-
"provider": "openai", // Required: AI provider to use
310-
"model": "gpt-4", // AI model to use
311-
"temperature": 0.7, // Creativity (0-2)
312-
"maxTokens": 2000, // Max response length
313-
"systemPrompt": "...", // Custom system prompt
314-
"frequencyPenalty": 0, // Frequency penalty (0-2)
315-
"presencePenalty": 0, // Presence penalty (0-2)
316-
"topP": 1, // Nucleus sampling
317-
"maxMessages": 10, // Max failed tests to analyze
318-
"consolidate": true, // Consolidate multiple failures
319-
"additionalPromptContext": "...", // Additional prompt context
320-
"additionalSystemPromptContext": "...", // Additional system prompt context
321-
"log": false, // Enable logging
322-
"deploymentId": "...", // Azure OpenAI deployment ID (Azure only)
323-
"url": "..." // Custom OpenAI compatible AI provider url, in-house solutions, LocalAI, Ollama, etc
324-
}
325-
```
326-
327221
## Pull Requests
328222

329223
You can add a pull request comment by using the `pull-request-report` input:
@@ -551,11 +445,17 @@ CTRF tooling offers seamless developer tool integration, allowing you to combine
551445
|------------|-------------|------------|
552446
| Slack Test Reporter | Send test results and notifications to Slack channels | [ctrf-io/slack-test-reporter](https://github.com/ctrf-io/slack-test-reporter) |
553447
| Microsoft Teams Test Reporter | Post test results and alerts to Teams channels | [ctrf-io/teams-test-reporter](https://github.com/ctrf-io/teams-test-reporter) |
448+
| AI Test Reporter | Intelligent test analysis using leading AI models | [ctrf-io/ai-test-reporter](https://github.com/ctrf-io/ai-test-reporter) |
554449

555450
For detailed information about configuring and using these integrations, see our [Integrations Documentation](docs/integrations.md).
556451

557452
Integrations are currently in beta. Please report any issues to the [GitHub Test Reporter repository](https://github.com/ctrf-io/github-test-reporter/issues).
558453

454+
## Generating an AI Report
455+
456+
You can generate human-readable AI report for your failed tests using models
457+
from the leading AI providers by using the AI Test Reporter integration or the [AI Test Reporter](https://github.com/ctrf-io/ai-test-reporter) directly.
458+
559459
## Further Processing
560460

561461
You can further process the CTRF report by using the output `report` from the action or by using the `write-ctrf-to-file` input. For reports larger than 1MB, consider using the `write-ctrf-to-file` input.
@@ -589,4 +489,4 @@ analyzing test outcomes across multiple platforms becomes more straightforward.
589489
## Support Us
590490

591491
If you find this project useful, consider giving it a GitHub star ⭐ It means a
592-
lot to us.
492+
lot to us.

docs/build-your-own-report.md

Lines changed: 152 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ This template demonstrates:
9292

9393
And what it looks like:
9494

95-
![Custom Report Example](../images/custom-one.png)
96-
9795
## Handlebars
9896

9997
Handlebars is a simple templating language that lets you insert data into your
@@ -107,7 +105,7 @@ When writing your template, you can use Handlebars helpers:
107105
- `{{eq arg1 arg2}}`: Compares two arguments and returns true if they are equal.
108106

109107
See available helpers
110-
[here](https://github.com/ctrf-io/handlebars-helpers-ctrf).
108+
[handlebars-helpers-ctrf repository](https://github.com/ctrf-io/handlebars-helpers-ctrf).
111109

112110
We welcome contributions for additional helpers.
113111

@@ -145,25 +143,164 @@ Example accessing test data:
145143

146144
## GitHub Properties
147145

148-
GitHub properties are made available to use in your template. You can access
149-
these properties by using the `github` property, for example `github.repoName`
146+
GitHub properties are made available to use in your template. You can access these properties by using the `github` property, for example `github.repoName` or `github.actor`.
147+
148+
### Root Context Properties
149+
150+
Access workflow and execution information:
151+
152+
**Workflow Information:**
153+
154+
- `github.workflow` - Name of the workflow
155+
- `github.action` / `github.action_name` - Current action name
156+
- `github.job` / `github.job_id` / `github.jobName` - Current job identifier
157+
- `github.runNumber` / `github.run_number` - Unique number for each workflow run
158+
- `github.runId` / `github.run_id` / `github.workflowId` - Unique identifier for the workflow run
159+
- `github.workflowName` - Workflow name (legacy property)
160+
161+
**Event Information:**
162+
163+
- `github.eventName` / `github.event_name` - Event that triggered the workflow (e.g., "push", "pull_request")
164+
- `github.actor` / `github.actor_name` / `github.actorName` - User who triggered the workflow
165+
- `github.sha` - Commit SHA that triggered the workflow
166+
- `github.ref` - Git ref that triggered the workflow (e.g., "refs/heads/main")
167+
- `github.branchName` - Current branch name
168+
169+
**Repository & URLs:**
170+
171+
- `github.repoName` - Repository name
172+
- `github.buildUrl` / `github.build_url` - URL to the workflow run summary
173+
- `github.serverUrl` / `github.server_url` / `github.baseURL` - GitHub server URL (e.g., `https://github.com`)
174+
- `github.apiUrl` / `github.api_url` - GitHub API URL (e.g., `https://api.github.com`)
175+
- `github.graphqlUrl` / `github.graphql_url` - GitHub GraphQL API URL
176+
177+
**Pull Request (at root level):**
178+
179+
- `github.pullRequestNumber` - PR number (legacy property, prefer `github.pullRequest.number`)
180+
181+
### Repository Properties (`github.repository`)
182+
183+
Access repository information:
184+
185+
**Basic Info:**
186+
187+
- `github.repository.name` - Repository name
188+
- `github.repository.fullName` / `github.repository.full_name` - Owner and repository name (e.g., "owner/repo")
189+
- `github.repository.description` - Repository description
190+
- `github.repository.language` - Primary language
191+
- `github.repository.defaultBranch` / `github.repository.default_branch` - Default branch name
192+
- `github.repository.licenseName` / `github.repository.license_name` - License name
193+
194+
**Statistics:**
195+
196+
- `github.repository.size` - Repository size in KB
197+
- `github.repository.stargazersCount` / `github.repository.stargazers_count` - Number of stars
198+
- `github.repository.openIssuesCount` / `github.repository.open_issues_count` - Number of open issues
199+
200+
**URLs:**
201+
202+
- `github.repository.htmlUrl` / `github.repository.html_url` - Repository URL
203+
- `github.repository.cloneUrl` / `github.repository.clone_url` - HTTPS clone URL
204+
- `github.repository.sshUrl` / `github.repository.ssh_url` - SSH clone URL
205+
- `github.repository.compareUrl` / `github.repository.compare_url` - Compare URL
206+
- `github.repository.contributorsUrl` / `github.repository.contributors_url` - Contributors page URL
207+
- `github.repository.deploymentsUrl` / `github.repository.deployments_url` - Deployments URL
208+
- `github.repository.downloadsUrl` / `github.repository.downloads_url` - Downloads URL
209+
- `github.repository.eventsUrl` / `github.repository.events_url` - Events URL
210+
- `github.repository.forksUrl` / `github.repository.forks_url` - Forks URL
211+
- `github.repository.stargazersUrl` / `github.repository.stargazers_url` - Stargazers URL
212+
- `github.repository.statusesUrl` / `github.repository.statuses_url` - Commit statuses URL
213+
- `github.repository.subscriptionUrl` / `github.repository.subscription_url` - Subscription URL
214+
- `github.repository.tagsUrl` / `github.repository.tags_url` - Tags URL
215+
- `github.repository.teamsUrl` / `github.repository.teams_url` - Teams URL
216+
217+
**Settings:**
218+
219+
- `github.repository.allowForking` / `github.repository.allow_forking` - Whether forking is allowed
220+
- `github.repository.createdAt` / `github.repository.created_at` - Repository creation timestamp
221+
222+
### Pull Request Properties (`github.pullRequest`)
150223

151-
You can access the entire context via the `github.context` property.
224+
Access pull request information (available when triggered by PR events):
152225

153-
[Contexts](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs)
154-
are a way to access information about workflow runs, variables, runner
155-
environments, jobs, and steps. Each context is an object that contains
156-
properties, which can be strings or other objects.
226+
**Basic Info:**
157227

158-
Contexts, objects, and properties will vary significantly under different
159-
workflow run conditions. For example, the matrix context is only populated for
160-
jobs in a matrix.
228+
- `github.pullRequest.id` - PR ID
229+
- `github.pullRequest.number` - PR number
230+
- `github.pullRequest.title` - PR title
231+
- `github.pullRequest.body` - PR description
232+
- `github.pullRequest.state` - PR state ("open", "closed")
233+
- `github.pullRequest.draft` - Whether PR is a draft (boolean)
234+
- `github.pullRequest.rebaseable` - Whether PR can be rebased (boolean or null)
161235

162-
You can see the content of the context by printing it in the logs:
236+
**Changes:**
237+
238+
- `github.pullRequest.additions` - Lines added
239+
- `github.pullRequest.deletions` - Lines deleted
240+
- `github.pullRequest.changedFiles` / `github.pullRequest.changed_files` - Number of files changed
241+
242+
**Collaboration:**
243+
244+
- `github.pullRequest.assignee` - Assigned user object (or null)
245+
- `github.pullRequest.assignees` - Array of assigned users
246+
- `github.pullRequest.authorAssociation` / `github.pullRequest.author_association` - Author's association with the repository
247+
- `github.pullRequest.requestedReviewers` / `github.pullRequest.requested_reviewers` - Array of requested reviewers
248+
- `github.pullRequest.requestedTeams` / `github.pullRequest.requested_teams` - Array of requested teams
249+
- `github.pullRequest.comments` - Number of comments
250+
- `github.pullRequest.reviewComments` / `github.pullRequest.review_comments` - Number of review comments
251+
- `github.pullRequest.labels` - Array of labels
252+
253+
**URLs:**
254+
255+
- `github.pullRequest.htmlUrl` / `github.pullRequest.html_url` - PR URL
256+
- `github.pullRequest.diffUrl` / `github.pullRequest.diff_url` - Diff URL
257+
- `github.pullRequest.patchUrl` / `github.pullRequest.patch_url` - Patch URL
258+
259+
**Timestamps:**
260+
261+
- `github.pullRequest.createdAt` / `github.pullRequest.created_at` - Creation timestamp
262+
- `github.pullRequest.closedAt` / `github.pullRequest.closed_at` - Closed timestamp (or null)
263+
- `github.pullRequest.pushedAt` / `github.pullRequest.pushed_at` - Last push timestamp
264+
265+
**Merge Settings:**
266+
267+
- `github.pullRequest.autoMerge` / `github.pullRequest.auto_merge` - Auto-merge configuration (or null)
268+
269+
### Sender Properties (`github.sender`)
270+
271+
Access information about the user who triggered the workflow:
272+
273+
- `github.sender.login` - Username
274+
- `github.sender.id` - User ID
275+
- `github.sender.nodeId` / `github.sender.node_id` - Node ID
276+
- `github.sender.type` - User type (e.g., "User", "Bot")
277+
- `github.sender.siteAdmin` / `github.sender.site_admin` - Whether user is a site admin (boolean)
278+
- `github.sender.htmlUrl` / `github.sender.html_url` - User profile URL
279+
- `github.sender.avatarUrl` / `github.sender.avatar_url` - User avatar URL
280+
- `github.sender.gravatarId` / `github.sender.gravatar_id` - Gravatar ID
281+
282+
### Full Context Access
283+
284+
You can access the complete webhook event payload via `github.context`. This contains the raw event payload data sent by GitHub when the workflow was triggered (e.g., the full `pull_request` object, `repository` object, `issue` object, etc. depending on the event type).
285+
286+
This is useful for accessing event-specific data that isn't exposed in the structured properties above. For example:
287+
288+
- `github.context.pull_request.head.ref` - Head branch name
289+
- `github.context.pull_request.base.ref` - Base branch name
290+
- `github.context.issue` - Issue data (for issue events)
291+
- `github.context.comment` - Comment data (for comment events)
292+
293+
See the [GitHub Actions events documentation](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows) for available event types.
294+
295+
**Note:** Contexts, objects, and properties will vary significantly under different workflow run conditions. For example, pull request properties are only available when the workflow is triggered by a pull request event.
296+
297+
### Debugging Available Properties
298+
299+
To see all available properties for your specific workflow, print the context in your workflow logs:
163300

164301
```yaml
165302
- name: Print GitHub Context
166303
env:
167304
CONTEXT: ${{ toJson(github) }}
168305
run: echo "$CONTEXT" | jq .
169-
```
306+
```

0 commit comments

Comments
 (0)