Skip to content

Commit 25b9802

Browse files
committed
Switch CI workflow to pull_request (plus push/workflow_dispatch) to avoid pull_request_target footguns
1 parent 196b448 commit 25b9802

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
name: CI
22

33
on:
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:
4+
pull_request:
85
types: [opened, synchronize, reopened]
6+
push:
7+
branches: [main]
8+
workflow_dispatch:
99

1010
permissions:
1111
contents: read
1212

1313
jobs:
1414
test:
15-
name: Test
15+
name: Test (macOS)
16+
# The reusable workflow consumes secrets,
17+
# which are not available to fork PRs.
18+
# Limit this job to trusted, same-repo PRs.
19+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
1620
uses: huggingface/hf-workflows/.github/workflows/swift_transformers_unit_tests.yml@main
1721
with:
1822
# Use the PR merge ref, not the head.
@@ -42,11 +46,11 @@ jobs:
4246
- name: Run tests
4347
env:
4448
CI_DISABLE_NETWORK_MONITOR: "1"
45-
HF_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}
4649
# Skip test targets that use URLSession on Linux due to a
4750
# FoundationNetworking race condition that crashes during teardown.
4851
# See: https://github.com/swiftlang/swift-corelibs-foundation/issues/3675
49-
run: swift test --skip HubTests --skip TokenizersTests
52+
run: |
53+
swift test --skip HubTests --skip TokenizersTests
5054
lint:
5155
name: Lint
5256
runs-on: macos-latest

0 commit comments

Comments
 (0)