Skip to content

Commit 01d1968

Browse files
committed
ci(workflows,cli): fix e2e workflow script chaining and GitHub API auth
1 parent 298f884 commit 01d1968

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

.github/workflows/e2e.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ jobs:
4040
with:
4141
api-level: 31
4242
arch: x86_64
43-
script: |
44-
export PATH="$HOME/.maestro/bin:$PATH"
45-
cd examples/hello-world
46-
pn run android
47-
sleep 5
48-
cd ../..
43+
script: >-
44+
cd examples/hello-world &&
45+
pn run android &&
46+
sleep 5 &&
47+
cd ../.. &&
4948
maestro test tests/e2e/android.yaml
5049
5150
e2e-ios:
@@ -73,6 +72,8 @@ jobs:
7372
- name: Build and launch iOS app
7473
working-directory: examples/hello-world
7574
run: pn run ios
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7677

7778
- name: Run E2E tests
7879
run: maestro --platform ios test tests/e2e/ios.yaml

src/pythonnative/cli/pn.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ def _copy_bundled_template_dir(template_dir: str, destination: str) -> None:
156156

157157

158158
def _github_json(url: str) -> Any:
159-
req = urllib.request.Request(url, headers={"User-Agent": "pythonnative-cli"})
159+
headers: dict[str, str] = {"User-Agent": "pythonnative-cli"}
160+
token = os.environ.get("GITHUB_TOKEN") or os.environ.get("GH_TOKEN")
161+
if token:
162+
headers["Authorization"] = f"Bearer {token}"
163+
req = urllib.request.Request(url, headers=headers)
160164
with urllib.request.urlopen(req) as r:
161165
return json.loads(r.read().decode("utf-8"))
162166

0 commit comments

Comments
 (0)