Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
env:
COSMOSDB_ENDPOINT: https://localhost:8081
COSMOSDB_KEY: C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==
COPILOT_GITHUB_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ github.token }}
OpenAI__ApiKey: ${{ secrets.OPENAI__APIKEY }}
OpenAI__ChatModelId: ${{ vars.OPENAI__CHATMODELID }}
OpenAI__ChatReasoningModelId: ${{ vars.OPENAI__CHATREASONINGMODELID }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ jobs:
contents: read
timeout-minutes: 60
env:
COPILOT_GITHUB_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_COPILOT_TIMEOUT: "120"
defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-merge-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ jobs:
contents: read
timeout-minutes: 60
env:
COPILOT_GITHUB_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_COPILOT_TIMEOUT: "120"
defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-sample-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ jobs:
contents: read
id-token: write
env:
COPILOT_GITHUB_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_COPILOT_MODEL: claude-opus-4.6
defaults:
run:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,20 @@ public class GitHubCopilotAgentTests
{
private static void SkipIfCopilotNotConfigured()
{
if (string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("COPILOT_GITHUB_TOKEN")))
bool actionsAuth =
string.Equals(Environment.GetEnvironmentVariable("GITHUB_ACTIONS"), "true", StringComparison.OrdinalIgnoreCase) &&
!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("GITHUB_TOKEN"));
bool localOptIn =
string.Equals(
Comment thread
moonbox3 marked this conversation as resolved.
Environment.GetEnvironmentVariable("RUN_COPILOT_INTEGRATION_TESTS"),
"true",
StringComparison.OrdinalIgnoreCase);

if (!actionsAuth && !localOptIn)
{
Assert.Skip("COPILOT_GITHUB_TOKEN not set; skipping GitHub Copilot integration tests.");
Assert.Skip(
"GitHub Actions auth is unavailable and RUN_COPILOT_INTEGRATION_TESTS is not true; " +
"skipping GitHub Copilot integration tests.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3475,11 +3475,44 @@ def test_prepare_attachments_skips_non_base64_data_uri(self) -> None:


# ---------------------------------------------------------------------------
# Integration tests — require COPILOT_GITHUB_TOKEN env var
# Integration tests — require GitHub Actions auth or explicit local opt-in
# ---------------------------------------------------------------------------
def _copilot_integration_configured() -> bool:
actions_auth = os.getenv("GITHUB_ACTIONS", "").lower() == "true" and bool(os.getenv("GITHUB_TOKEN", "").strip())
local_opt_in = os.getenv("RUN_COPILOT_INTEGRATION_TESTS", "").lower() == "true"
Comment thread
moonbox3 marked this conversation as resolved.
return actions_auth or local_opt_in


@pytest.mark.parametrize(
("environment", "expected"),
[
({}, False),
({"GITHUB_TOKEN": "unrelated-token"}, False),
({"GITHUB_ACTIONS": "true"}, False),
({"GITHUB_ACTIONS": "true", "GITHUB_TOKEN": "actions-token"}, True),
({"RUN_COPILOT_INTEGRATION_TESTS": "true"}, True),
],
)
def test_copilot_integration_configured(
monkeypatch: pytest.MonkeyPatch,
environment: dict[str, str],
expected: bool,
) -> None:
"""Integration tests require Actions auth or an explicit local opt-in."""
monkeypatch.delenv("GITHUB_ACTIONS", raising=False)
monkeypatch.delenv("GITHUB_TOKEN", raising=False)
monkeypatch.delenv("RUN_COPILOT_INTEGRATION_TESTS", raising=False)
for name, value in environment.items():
monkeypatch.setenv(name, value)

assert _copilot_integration_configured() is expected


skip_if_copilot_integration_tests_disabled = pytest.mark.skipif(
os.getenv("COPILOT_GITHUB_TOKEN", "") == "",
reason="No COPILOT_GITHUB_TOKEN provided; skipping integration tests.",
not _copilot_integration_configured(),
reason=(
"GitHub Actions auth is unavailable and RUN_COPILOT_INTEGRATION_TESTS is not true; skipping integration tests."
),
)


Expand Down
Loading