Skip to content

Commit 7c73097

Browse files
chore: only allow triggers on pull requests (#30)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 07f57ef commit 7c73097

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@ Only Java is supported by this action. Please see our [JavaScript action](https
8080
# Useful for consuming non-default branches, like in testing
8181
# Defants to empty, cloning the default branch
8282
branch: ""
83-
84-
# Bash array of events for limiting triggers, otherwise trigger automatically
85-
# E.g. ("pull_request" "push" "workflow_dispatch")
86-
# Defaults to only using triggers with pull requests
87-
triggers_event: "('pull_request')"
8883
```
8984
9085
# Example, Single Directory with SonarCloud Analysis
@@ -200,10 +195,6 @@ After sign up, a token should be available from your project on the [SonarCloud]
200195

201196
E.g. https://sonarcloud.io/project/configuration?id={<PROJECT>}&analysisMode=GitHubActions
202197

203-
# Triggers and Triggers_Event
204-
205-
Triggers are used to limit test running to only appropriate files are changed. This is generally not desirable outside of pull requests, so `triggers_event` defaults to `("pull_request")`. Override this behaviour by specifying a bash array using any of the many, many [event types GitHub provides](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push), e.g. `("branch_protection_rule" "workflow_dispatch" "push")`.
206-
207198
# Feedback
208199

209200
Please contribute your ideas! [Issues] and [pull requests] are appreciated.

action.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ inputs:
5353
description: Non-default branch to clone (used for testing this action)
5454
default: ""
5555

56-
triggers_event:
57-
description: Events (array) to use with triggers; e.g. ("pull_request" "push" "workflow_dispatch")
58-
default: "('pull_request')"
59-
6056
runs:
6157
using: composite
6258
steps:
@@ -72,11 +68,11 @@ runs:
7268
exit 1
7369
fi
7470
75-
# Send triggers to diff action
71+
# Send triggers to diff action, but only for pull requests
7672
- id: diff
7773
uses: bcgov/action-diff-triggers@v0.2.0
7874
with:
79-
triggers: ${{ inputs.triggers }}
75+
triggers: ${{ (github.event_name == 'pull_request' && inputs.triggers) || '' }}
8076
diff_branch: ${{ inputs.diff_branch }}
8177

8278
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)