Skip to content

Commit

Permalink
feat: add commentId to support multiple runs in the same PR
Browse files Browse the repository at this point in the history
  • Loading branch information
BioPhoton authored Jul 13, 2023
2 parents 750de97 + c15945d commit 6445167
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 8 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,21 @@ jobs:
add: '*'
- name: test-unit:action
run: npm run nx test action
- name: run:action
id: localRun
- name: run:action ( e2e test run for real output )
uses: ./
with:
commentId: test-e2e-first-run
dryRun: off
verbose: on
url: https://google.com
ufPath: ./user-flows
outPath: ./packages/user-flow-gh-action-e2e/measures
format: html,json
rcPath: ./.user-flowrc.json
- name: run:action ( dummy run for to test multiple comments )
uses: ./
with:
commentId: test-e2e-second-run
dryRun: on
ufPath: ./user-flows/flow.uf.ts
rcPath: ./.user-flowrc.json
1 change: 1 addition & 0 deletions .github/workflows/user-flow_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
id: localRun
uses: ./dist/packages/user-flow-gh-action/
with:
commentId: test-e2e-the-outputs
dryRun: off
verbose: on
url: https://google.com
Expand Down
9 changes: 7 additions & 2 deletions .user-flowrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"collect": {},
"collect": {
"url": "https://google.com",
"ufPath": "./user-flows"
},
"persist": {
"budgets": []
"budgets": [],
"outPath": "./packages/user-flow-gh-action-e2e/measures",
"format": ["json"]
},
"assert": {}
}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ It automatically detects flows, executes them and produces md reports as comment
**Inputs:**
| Name | Type | Default | Description |
|------------------------------| --------- | --------------------------- |----------------------------------------------------------------------------------------------------------- |
| **`--customScript`** | `string` | `undefined` | PCustom way to execute user-flow (helpfule if the default way of execution is not given) |
| **`--rcPath`** | `string` | `./user-flowrc.json` | Path to user-flow.config.json. e.g. `./user-flowrc.json` |
| **`--commentId`** | `string` | `user flow summary report` | Id used to identify a comment in the PR (useful if multiple actions run user-flow for the same PR) |
| **`--customScript`** | `string` | `undefined` | Custom way to execute user-flow (helpfule if the default way of execution is not given) |
| **`--rcPath`** | `string` | `./user-flowrc.json` | Path to `.user-flowrc.json`. e.g. `./user-flowrc.server.json` |
| **`--verbose`** | `string` | `off` | Run with verbose logging (only 'on' and 'off' is possible) |
| **`--dryRun`** | `string` | `off` | Run in `dryRun` mode (only 'on' and 'off' is possible) |

Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: 'Lighthouse User Flow CI Action'
description: "Audit URL's using Lighthouse user flow and test performance within PR's"
inputs:
# GLOBAL ============================================
commentId:
description: 'A custom id to identify a comments in a PR'
required: false
default: "user flow summary report"
customScript:
description: 'A custom way to execute userflow. This is helpful if another lib wraps the userflow execution in the CI'
required: false
Expand Down Expand Up @@ -71,7 +75,7 @@ runs:
uses: marocchino/sticky-pull-request-comment@v2
with:
hide_and_recreate: true # collapse old comment & append new comment at the end
header: user flow summary report
header: ${{ inputs.commentId }}
message: ${{ steps.ruf.outputs.resultSummary }}
branding:
icon: 'bar-chart-2' # un-sorted bar chart
Expand Down
6 changes: 5 additions & 1 deletion packages/action/src/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: 'Lighthouse User Flow CI Action'
description: "Audit URL's using Lighthouse user flow and test performance within PR's"
inputs:
# GLOBAL ============================================
commentId:
description: 'A custom id to identify a comments in a PR'
required: false
default: "user flow summary report"
customScript:
description: 'A custom way to execute userflow. This is helpful if another lib wraps the userflow execution in the CI'
required: false
Expand Down Expand Up @@ -71,7 +75,7 @@ runs:
uses: marocchino/sticky-pull-request-comment@v2
with:
hide_and_recreate: true # collapse old comment & append new comment at the end
header: user flow summary report
header: ${{ inputs.commentId }}
message: ${{ steps.ruf.outputs.resultSummary }}
branding:
icon: 'bar-chart-2' # un-sorted bar chart
Expand Down

0 comments on commit 6445167

Please sign in to comment.