Skip to content

Commit 28dbbc4

Browse files
authored
Use pull_request_target and PR ref (#227)
1 parent 22ff92a commit 28dbbc4

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

.github/workflows/unit-tests.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
name: Unit Tests
22

33
on:
4-
push:
5-
branches: [ "main" ]
6-
pull_request:
7-
branches: [ "main" ]
8-
workflow_dispatch:
4+
# This runs in the context of the base of the pull request,
5+
# rather than in the context of the merge commit.
6+
# Maintainers must approve and we tighten permissions below.
7+
pull_request_target:
8+
types: [opened, synchronize, reopened]
9+
10+
permissions:
11+
contents: read
912

1013
jobs:
11-
build-and-test:
12-
uses: huggingface/hf-workflows/.github/workflows/swift_transformers_unit_tests.yml@main
13-
secrets: inherit
14+
build-and-test:
15+
uses: huggingface/hf-workflows/.github/workflows/swift_transformers_unit_tests.yml@main
16+
with:
17+
# Use the PR merge ref, not the head.
18+
pr_number: ${{ github.event.pull_request.number }}
19+
secrets: inherit

0 commit comments

Comments
 (0)