- Notifications
You must be signed in to change notification settings - Fork0
Create Github PR annotations from report files e.g. junit
License
granodigital/report-annotate
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Easily add annotations to your GitHub pull requests based on reports from yourtests, linters, etc.
steps: -name:Checkoutid:checkoutuses:actions/checkout@v4 -name:Run Tests & Lint etc.run:npm install && npm run test:lint:etc -name:Report Annotateid:annotateif:always()# Run with test/lint failures.uses:granodigital/report-annotate@v1with:reports:| junit|reports/junit-generic.xml junit-eslint|reports/*-eslint.xml junit-jest|reports/junit-jest.xmlmax-annotations:20# Keep the clutter down (50 is max by GitHub)ignore:node_modules/**,dist/**# Ignore patterns for the report search (default). -name:Annotations createdif:always()run:| echo "Total: ${{ steps.annotate.outputs.total }}" echo "Errors: ${{ steps.annotate.outputs.errors }}" echo "Warnings: ${{ steps.annotate.outputs.warnings }}" echo "Notices: ${{ steps.annotate.outputs.notices }}"
Note
You'll need to have a reasonably modern version ofNode.js handy (20.x or later should work!). If you areusing a version manager likenodenv orfnm, this template has a.node-versionfile at the root of the repository that can be used to automatically switch tothe correct version when youcd into the repository. Additionally, this.node-version file is used by GitHub Actions in anyactions/setup-nodeactions.
You can define custom matchers to parse your reports and create annotations.Currently only XML reports are supported using XPath selectors.
Feel free to open a PR to add support for new report formats or matchers.
See matchers folder for examples.
----name:Report Annotateid:annotateif:always()# Run with test/lint failures.uses:granodigital/report-annotate@v1with:reports:my-matcher|reports/*.xmlcustom-matchers:| { "my-matcher": { "format": "xml", "item": "//testCase", "title": "oopsie-daisy/@message", "message": "oopsie-daisy/text()", "file": "parent::testFile/@filePath", "startLine": "oopsie-daisy/@line" } }
Install the dependencies
npm install
🏗️ Package the TypeScript for distribution
npm run bundle
✅ Run the tests
$ npmtestPASS ./index.test.js ✓ throws invalid number (3ms) ✓wait 500 ms (504ms) ✓test runs (95ms)...
Theaction.yml file defines metadata about your action, such asinput(s) and output(s). For details about this file, seeMetadata syntax for GitHub Actions.
When you copy this repository, updateaction.yml with the name, description,inputs, and outputs for your action.
Thesrc/ directory is the heart of your action! This contains thesource code that will be run when your action is invoked. You can replace thecontents of this directory with your own code.
There are a few things to keep in mind when writing your action code:
Create a new branch
git checkout -b releases/v1
Replace the contents of
src/with your action codeAdd tests to
__tests__/for your source codeFormat, test, and build the action
npm run all
For information about versioning your action, seeVersioningin the GitHub Actions toolkit.
This project includes a helper script,script/releasedesigned to streamline the process of tagging and pushing new releases forGitHub Actions.
GitHub Actions allows users to select a specific version of the action to use,based on release tags. This script simplifies this process by performing thefollowing steps:
- Retrieving the latest release tag: The script starts by fetching the mostrecent SemVer release tag of the current branch, by looking at the local dataavailable in your repository.
- Prompting for a new release tag: The user is then prompted to enter a newrelease tag. To assist with this, the script displays the tag retrieved inthe previous step, and validates the format of the inputted tag (vX.X.X). Theuser is also reminded to update the version field in package.json.
- Tagging the new release: The script then tags a new release and syncs theseparate major tag (e.g. v1, v2) with the new release tag (e.g. v1.0.0,v2.1.2). When the user is creating a new major release, the scriptauto-detects this and creates a
releases/v#branch for the previous majorversion. - Pushing changes to remote: Finally, the script pushes the necessarycommits, tags and branches to the remote repository. From here, you will needto create a new release in GitHub so users can easily reference the new tagsin their workflows.
About
Create Github PR annotations from report files e.g. junit
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Languages
- TypeScript77.2%
- Shell14.0%
- JavaScript8.8%