@@ -10,6 +10,7 @@ A GitHub Action that automatically creates beautiful coverage reports in pull re
1010- 🔄 ** Smart Updates** : Updates existing comments instead of creating duplicates
1111- 🎨 ** Visual Indicators** : Uses emojis to quickly identify coverage status
1212- 🏷️ ** Coverage Badges** : Generates shields.io compatible badges locally
13+ - 🚀 ** Automatic GitHub Pages Upload** : Uploads badges to GitHub Pages
1314- ⚡ ** Lightweight** : Pure YAML and shell commands, no JavaScript complexity
1415- 🔧 ** Reliable** : No module system issues or permission headaches
1516
5859
5960permissions :
6061 pull-requests : write
62+ contents : write # Required for GitHub Pages upload
6163
6264jobs :
6365 coverage :
8486 show-files : " true"
8587 coverage-threshold : " 90"
8688 make-badges : " true"
89+ upload-badges-to-pages : " true"
90+ pages-branch : " gh-pages"
91+ pages-badges-dir : " badges"
8792
8893 # Optional: Upload badges to GitHub Pages
8994 - name : Deploy badges to GitHub Pages
@@ -97,14 +102,17 @@ jobs:
97102
98103## Inputs
99104
100- | Input | Description | Required | Default |
101- | -------------------- | --------------------------------------------------------- | -------- | -------------------------------- |
102- | ` coverage-file` | Path to the coverage summary JSON file | No | `coverage/coverage-summary.json` |
103- | `token` | GitHub token for creating comments | No | `${{ github.token }}` |
104- | `title` | Title for the coverage report comment | No | `📊 Coverage Report` |
105- | `show-files` | Whether to show individual file coverage details | No | `true` |
106- | `coverage-threshold` | Minimum coverage percentage to consider as good (0-100) | No | `80` |
107- | `make-badges` | Whether to generate coverage badges in a badges directory | No | `true` |
105+ | Input | Description | Required | Default |
106+ | ------------------------ | --------------------------------------------------------- | -------- | -------------------------------- |
107+ | ` coverage-file` | Path to the coverage summary JSON file | No | `coverage/coverage-summary.json` |
108+ | `token` | GitHub token for creating comments | No | `${{ github.token }}` |
109+ | `title` | Title for the coverage report comment | No | `📊 Coverage Report` |
110+ | `show-files` | Whether to show individual file coverage details | No | `true` |
111+ | `coverage-threshold` | Minimum coverage percentage to consider as good (0-100) | No | `80` |
112+ | `make-badges` | Whether to generate coverage badges in a badges directory | No | `true` |
113+ | `upload-badges-to-pages` | Whether to automatically upload badges to GitHub Pages | No | `true` |
114+ | `pages-branch` | Branch to upload badges to for GitHub Pages | No | `gh-pages` |
115+ | `pages-badges-dir` | Directory within the pages branch to store badges | No | `badges` |
108116
109117# # Coverage File Format
110118
@@ -219,27 +227,37 @@ When `make-badges` is enabled (default: `true`), the action creates a `badges` d
219227
220228### Using Badges with GitHub Pages
221229
222- The action generates badges locally. To deploy them to GitHub Pages, use a separate action:
230+ The action automatically uploads badges to your GitHub Pages branch when ` upload-badges-to-pages ` is enabled (default: ` true ` ).
223231
224- ``` yaml
225- - name : Deploy badges to GitHub Pages
226- if : github.ref == 'refs/heads/main'
227- uses : peaceiris/actions-gh-pages@v3
228- with :
229- github_token : ${{ secrets.GITHUB_TOKEN }}
230- publish_dir : ./badges
231- destination_dir : badges
232+ ** Automatic Setup:**
233+
234+ - Creates the ` gh-pages ` branch if it doesn't exist
235+ - Uploads badges to the specified directory
236+ - Commits and pushes changes automatically
237+
238+ ** Enable GitHub Pages** in your repository settings:
239+
240+ 1 . Go to Settings → Pages
241+ 2 . Set source to "Deploy from a branch"
242+ 3 . Select your ` gh-pages ` branch (or the branch specified in ` pages-branch ` )
243+ 4 . Set folder to ` / (root) ` or ` /badges ` depending on your preference
244+
245+ ** Badge URLs** will be available at:
246+
247+ ```
248+ https://yourusername.github.io/yourrepo/badges/coverage.json
249+ https://yourusername.github.io/yourrepo/badges/statements.json
250+ https://yourusername.github.io/yourrepo/badges/branches.json
251+ https://yourusername.github.io/yourrepo/badges/functions.json
252+ https://yourusername.github.io/yourrepo/badges/lines.json
232253```
233254
234- ### Example Badge JSON
255+ ** Use in your README.md: **
235256
236- ` ` ` json
237- {
238- " schemaVersion " : 1,
239- " label " : " coverage" ,
240- " message " : " 89.8%" ,
241- " color " : " green"
242- }
257+ ``` markdown
258+ 
259+ 
260+ 
243261```
244262
245263### Required Permissions
0 commit comments