|
50 | 50 | | `pack-size-threshold` | Threshold (in bytes) for warning about significant increase in total pack size | No | `50000` | |
51 | 51 | | `detect-replacements` | Detect modules which have community suggested alternatives | No | `true` | |
52 | 52 | | `working-directory` | Working directory to scan for package lock file | No | None | |
| 53 | +| `mode` | Run mode: `comment`, `artifact`, or `comment-from-artifact` | No | `comment` | |
| 54 | +| `artifact-path` | Path to the artifact JSON file (for `comment-from-artifact` mode) | No | None | |
53 | 55 |
|
54 | 56 | ## Example with custom inputs |
55 | 57 |
|
|
66 | 68 |
|
67 | 69 | See the [`recipes/`](./recipes/) directory for complete workflow examples: |
68 | 70 |
|
69 | | -- [`basic.yml`](./recipes/basic.yml) - Basic dependency diff on pull requests |
| 71 | +- [`basic/`](./recipes/basic/) - Basic dependency diff on pull requests |
| 72 | +- [`artifact/`](./recipes/artifact/) - Two-workflow setup using artifacts (no `pull_request_target` needed) |
70 | 73 | - [`bundle-diff.yml`](./recipes/bundle-diff.yml) - Advanced workflow with package bundle size analysis |
71 | 74 |
|
72 | 75 | ## Always Report Install Size |
@@ -126,6 +129,32 @@ permissions: |
126 | 129 | pull-requests: write # To comment on pull requests |
127 | 130 | ``` |
128 | 131 |
|
| 132 | +## Artifact Mode |
| 133 | + |
| 134 | +By default, the action posts a comment directly to the pull request. This requires `pull-requests: write` permission in the workflow that runs the analysis, which typically means using `pull_request_target` for fork PRs. |
| 135 | + |
| 136 | +If you'd prefer not to use `pull_request_target`, you can use a two-workflow setup with artifact mode: |
| 137 | + |
| 138 | +1. **Analyze workflow** (`pull_request`) - runs the analysis and uploads the result as an artifact: |
| 139 | + |
| 140 | +```yaml |
| 141 | +- name: Analyze Dependencies |
| 142 | + uses: e18e/action-dependency-diff@v1 |
| 143 | + with: |
| 144 | + mode: artifact |
| 145 | +``` |
| 146 | + |
| 147 | +2. **Comment workflow** (`workflow_run`) - downloads the artifact and posts the comment: |
| 148 | + |
| 149 | +```yaml |
| 150 | +- name: Post Comment |
| 151 | + uses: e18e/action-dependency-diff@v1 |
| 152 | + with: |
| 153 | + mode: comment-from-artifact |
| 154 | +``` |
| 155 | + |
| 156 | +See the [`recipes/artifact/`](./recipes/artifact/) directory for complete workflow files. |
| 157 | + |
129 | 158 | ## Trust levels of packages |
130 | 159 |
|
131 | 160 | The following levels are considered when evaluating package trust: |
|
0 commit comments