Skip to content

Commit 9ce53de

Browse files
Fix multiple triggers
1 parent 048dc9a commit 9ce53de

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

.github/workflows/linter.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,24 @@ permissions:
1111

1212
jobs:
1313
lint:
14-
if: github.event_name == 'pull_request' || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved')
14+
if: github.event.review.state == 'approved'
1515
name: Lint Code Base
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Checkout Code
1919
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2020
with:
21-
# Check out the head of the PR specifically
22-
ref: ${{ github.event.pull_request.head.sha }}
21+
# Check out the PR head through GitHub's pull ref for review events
22+
ref: refs/pull/${{ github.event.pull_request.number }}/head
2323
# Full git history is needed to get a proper list of changed files within `super-linter`
2424
fetch-depth: 0
2525
# Disable credential persistence to harden the runner
2626
persist-credentials: false
2727

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

@@ -33,5 +37,5 @@ jobs:
3337
env:
3438
VALIDATE_ALL_CODEBASE: false
3539
DEFAULT_BRANCH: ${{ github.event.pull_request.base.ref }}
36-
GITHUB_SHA: ${{ github.event.pull_request.head.sha }}
40+
GITHUB_SHA: ${{ steps.set_lint_sha.outputs.sha }}
3741
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)