Skip to content

Commit 934dc03

Browse files
committed
Conditional
1 parent f9f45e7 commit 934dc03

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

.github/workflows/tests.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ jobs:
3131
3232
tests:
3333
runs-on: ubuntu-24.04
34-
env:
35-
# This is a private access token for @choldgraf that has public read-only access.
36-
# WARNING: This only works for PRs from non-forked repositories.
37-
# FUTURE: We should update the tests to only pull from this repository and not
38-
# need a token at all.
39-
GITHUB_ACCESS_TOKEN: "${{ secrets.TOKEN_READONLY }}"
4034
strategy:
4135
matrix:
4236
include:
@@ -54,6 +48,14 @@ jobs:
5448
run: |
5549
python -m pip install --upgrade pip
5650
pip install -e .[testing]
51+
# This sets a private access token for @choldgraf that has public read-only access.
52+
# It only applies to a non-fork repository. If the repository for the PR is a fork,
53+
# then it won't run and we'll use the default repository rate limit.
54+
# FUTURE: We should update the tests to only pull from this repository and not
55+
# need a token at all.
56+
- name: Set variable if we're in a non-fork PR
57+
if: github.event.pull_request.head.repo.full_name == github.repository
58+
run: echo "GITHUB_ACCESS_TOKEN=${{ secrets.TOKEN_READONLY }}" >> $GITHUB_ENV
5759
- name: Run tests
5860
run: pytest --verbose --color=yes --durations=10
5961

0 commit comments

Comments
 (0)