File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 runs-on : ubuntu-latest
1616 timeout-minutes : 25
1717 env :
18+ # Use a repository *secret* (Settings → Secrets → Actions), not a variable.
1819 GH_TEST_REPO_TOKEN : ${{ secrets.GH_TEST_REPO_TOKEN }}
1920 steps :
2021 # actions/checkout v6.0.2
2728 with :
2829 python-version : ' 3.12'
2930
31+ - name : Check GitHub test token availability
32+ run : |
33+ set -euo pipefail
34+ if [ "${{ github.event_name }}" = "pull_request" ] && \
35+ [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
36+ echo "::notice::Fork PR: repository secrets (including GH_TEST_REPO_TOKEN)" \
37+ "are not passed to workflows from forks."
38+ fi
39+ if [ -n "${GH_TEST_REPO_TOKEN:-}" ]; then
40+ echo "GH_TEST_REPO_TOKEN is set (${#GH_TEST_REPO_TOKEN} characters)."
41+ else
42+ echo "::warning::GH_TEST_REPO_TOKEN is empty. E2E/Celery functional tests will be skipped."
43+ echo "Add a classic PAT with the 'repo' scope as repository secret GH_TEST_REPO_TOKEN."
44+ echo "Re-run the workflow after saving the secret (secrets are not applied retroactively to old runs)."
45+ fi
46+
3047 - name : Run integration functional tests
3148 run : bash scripts/integration-functional.sh
3249
Original file line number Diff line number Diff line change @@ -42,6 +42,13 @@ export WEBLATE_COMPOSE_PROJECT="${COMPOSE_PROJECT_NAME}"
4242echo " === Extracting Weblate SSH public key ==="
4343export WEBLATE_SSH_PUBKEY=" $( compose exec -T weblate cat /app/data/ssh/id_rsa.pub) "
4444
45+ if [[ -n " ${GH_TEST_REPO_TOKEN:- } " ]]; then
46+ export GH_TEST_REPO_TOKEN
47+ echo " === GH_TEST_REPO_TOKEN is set (${# GH_TEST_REPO_TOKEN} chars); GitHub E2E tests enabled ==="
48+ else
49+ echo " === GH_TEST_REPO_TOKEN is not set; GitHub E2E/Celery tests will be skipped ==="
50+ fi
51+
4552echo " === Running functional tests ==="
4653pip install --quiet pytest pytest-timeout
4754python -m pytest --confcutdir=tests/integration --override-ini addopts= \
Original file line number Diff line number Diff line change @@ -59,7 +59,11 @@ def test_repo(weblate_ssh_pubkey: str) -> EphemeralGitHubRepo:
5959 """Ephemeral GitHub repo with fixture docs and Weblate deploy key."""
6060 token = os .environ .get ("GH_TEST_REPO_TOKEN" , "" ).strip ()
6161 if not token :
62- pytest .skip ("GH_TEST_REPO_TOKEN is not set" )
62+ pytest .skip (
63+ "GH_TEST_REPO_TOKEN is not set in the job environment "
64+ "(repository Actions secret with classic PAT 'repo' scope; "
65+ "not available on pull_request workflows from forks)"
66+ )
6367
6468 repo_name = default_repo_name ()
6569 manager = EphemeralGitHubRepo (token , repo_name )
You can’t perform that action at this time.
0 commit comments