Skip to content

Commit e2ba341

Browse files
authored
chore: only allow triggers on pull requests (#66)
1 parent b628ce7 commit e2ba341

File tree

3 files changed

+2
-19
lines changed

3 files changed

+2
-19
lines changed

.github/workflows/tests.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,11 @@ jobs:
2727
- name: backend
2828
dir: backend
2929
triggers: ('backend/')
30-
triggers_event: ('pull_request')
3130
- name: frontend-merge
3231
dir: frontend
3332
triggers: ('.')
34-
triggers_event: ('pull_request')
3533
- name: frontend-pr
3634
dir: frontend
37-
triggers_event: ('push')
3835
steps:
3936
- uses: actions/checkout@v4
4037
- uses: ./
@@ -56,4 +53,3 @@ jobs:
5653
|| matrix.name == 'frontend-pr' && secrets.SONAR_TOKEN_FRONTEND
5754
|| '' }}
5855
triggers: ${{ matrix.triggers }}
59-
triggers_event: ${{ matrix.triggers_event }}

README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,6 @@ Only nodejs (JavaScript, TypeScript) is supported by this action. Please see ou
7878
# Useful for consuming non-default branches, like in testing
7979
# Defants to empty, cloning the default branch
8080
branch: ""
81-
82-
# Bash array of events for limiting triggers, otherwise trigger automatically
83-
# E.g. ("pull_request" "push" "workflow_dispatch")
84-
# Defaults to only using triggers with pull requests
85-
triggers_event: "('pull_request')"
8681
```
8782
8883
# Example, Single Directory with SonarCloud Analysis
@@ -199,10 +194,6 @@ After sign up, a token should be available from your project on the [SonarCloud]
199194

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

202-
# Triggers and Triggers_Event
203-
204-
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")`.
205-
206197
# Feedback
207198

208199
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
@@ -49,10 +49,6 @@ inputs:
4949
description: Non-default branch to clone (used for testing this action)
5050
default: ""
5151

52-
triggers_event:
53-
description: Events (array) to use with triggers; e.g. ("pull_request" "push" "workflow_dispatch")
54-
default: "('pull_request')"
55-
5652
runs:
5753
using: composite
5854
steps:
@@ -82,11 +78,11 @@ runs:
8278
exit 1
8379
fi
8480
85-
# Send triggers to diff action
81+
# Send triggers to diff action, but only for pull requests
8682
- id: diff
8783
uses: bcgov/action-diff-triggers@v0.2.0
8884
with:
89-
triggers: ${{ inputs.triggers }}
85+
triggers: ${{ github.event_name == 'pull_request' && inputs.triggers || '' }}
9086
diff_branch: ${{ inputs.diff_branch }}
9187

9288
# Shallow clone is faster, but SonarCloud requires a full clone

0 commit comments

Comments
 (0)