Skip to content

Commit c32dfe8

Browse files
Fix multiple triggers
1 parent 29f6177 commit c32dfe8

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

.github/workflows/linter.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Lint Code Base
22

33
on:
4-
pull_request:
5-
types: [opened, synchronize, reopened, ready_for_review]
64
pull_request_review:
75
types: [submitted]
86

@@ -11,20 +9,24 @@ permissions:
119

1210
jobs:
1311
lint:
14-
if: github.event_name == 'pull_request' || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved')
12+
if: github.event.review.state == 'approved'
1513
name: Lint Code Base
1614
runs-on: ubuntu-latest
1715
steps:
1816
- name: Checkout Code
1917
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2018
with:
21-
# Check out the head of the PR specifically
22-
ref: ${{ github.event.pull_request.head.sha }}
19+
# Check out the PR head through GitHub's pull ref for review events
20+
ref: refs/pull/${{ github.event.pull_request.number }}/head
2321
# Full git history is needed to get a proper list of changed files within `super-linter`
2422
fetch-depth: 0
2523
# Disable credential persistence to harden the runner
2624
persist-credentials: false
2725

26+
- name: Set lint SHA from checked-out HEAD
27+
id: set_lint_sha
28+
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
29+
2830
- name: Fetch base branch for diff
2931
run: git fetch --no-tags --prune origin "+refs/heads/${{ github.event.pull_request.base.ref }}:refs/remotes/origin/${{ github.event.pull_request.base.ref }}"
3032

@@ -33,5 +35,5 @@ jobs:
3335
env:
3436
VALIDATE_ALL_CODEBASE: false
3537
DEFAULT_BRANCH: ${{ github.event.pull_request.base.ref }}
36-
GITHUB_SHA: ${{ github.event.pull_request.head.sha }}
38+
GITHUB_SHA: ${{ steps.set_lint_sha.outputs.sha }}
3739
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)