Skip to content

Commit 54da59f

Browse files
jhen0409zgosalvez
andauthored
Support create comment on pull_request_target event (#22)
* Support pull_request_target event * Update README.md * Run prepare Co-authored-by: Zennon Gosalvez <1798166+zgosalvez@users.noreply.github.com>
1 parent 7a0c803 commit 54da59f

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
github-token: ${{ secrets.GITHUB_TOKEN }}
5050
working-directory: apps/my-first-app
5151
```
52+
*Note:* Only the `pull_request` and `pull_request_target` events are supported. This action does nothing when triggered by other event types.
5253

5354
### Flutter Workflows
5455

dist/main/index.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const lcovTotal = require("lcov-total");
77
const os = require('os');
88
const path = require('path');
99

10+
const events = ['pull_request', 'pull_request_target'];
11+
1012
async function run() {
1113
try {
1214
await exec.exec('sudo apt-get install -y lcov');
@@ -25,7 +27,7 @@ async function run() {
2527
const errorMessage = `The code coverage is too low. Expected at least ${minimumCoverage}.`;
2628
const isFailure = totalCoverage < minimumCoverage;
2729

28-
if (gitHubToken !== '' && github.context.eventName === 'pull_request') {
30+
if (gitHubToken !== '' && events.includes(github.context.eventName)) {
2931
const octokit = await github.getOctokit(gitHubToken);
3032
const summary = await summarize(coverageFile);
3133
const details = await detail(coverageFile, octokit);

0 commit comments

Comments
 (0)