Skip to content

Commit f9f45e7

Browse files
committed
Fix
1 parent 7e8c689 commit f9f45e7

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

.github/workflows/tests.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ jobs:
3333
runs-on: ubuntu-24.04
3434
env:
3535
# This is a private access token for @choldgraf that has public read-only access.
36-
GHA_ACCESS_TOKEN: "${{ secrets.TOKEN_READONLY }}"
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 }}"
3740
strategy:
3841
matrix:
3942
include:

github_activity/github_activity.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,16 @@ def get_activity(
170170
search_query = f"user:{org}"
171171

172172
if auth is None:
173-
for kind in ["GITHUB_ACCESS_TOKEN", "GHA_ACCESS_TOKEN"]:
174-
if kind in os.environ:
173+
for authkey in ["GITHUB_ACCESS_TOKEN", "GHA_ACCESS_TOKEN"]:
174+
if authkey in os.environ:
175175
# Access token is stored in a local environment variable so just use this
176176
print(
177-
f"Using GH access token stored in `{kind}`.",
177+
f"Using GH access token stored in `{authkey}`.",
178178
file=sys.stderr,
179179
)
180-
auth = os.environ.get(kind)
180+
auth = os.environ.get(authkey)
181181
if auth == "":
182-
raise ValueError(f"Found {kind}, but it is empty...")
182+
raise ValueError(f"Found {authkey}, but it is empty...")
183183

184184
if auth is None:
185185
# Attempt to use the gh cli if installed
@@ -220,7 +220,7 @@ def get_activity(
220220
if kind:
221221
allowed_kinds = ["issue", "pr"]
222222
if kind not in allowed_kinds:
223-
raise ValueError(f"Kind must be one of {allowed_kinds}")
223+
raise ValueError(f"Kind must be one of {allowed_kinds}, got {kind}")
224224
search_query += f" type:{kind}"
225225

226226
# Query for both opened and closed issues/PRs in this window

0 commit comments

Comments
 (0)