Skip to content

ci: let Dependabot integration tests run via pull_request_target#199

Open
ionmincu wants to merge 2 commits into
mainfrom
ci/dependabot-config-and-test-hardening
Open

ci: let Dependabot integration tests run via pull_request_target#199
ionmincu wants to merge 2 commits into
mainfrom
ci/dependabot-config-and-test-hardening

Conversation

@ionmincu
Copy link
Copy Markdown
Collaborator

@ionmincu ionmincu commented May 13, 2026

Summary

Make Dependabot PRs actually able to run integration tests, ported from uipath-python PR #1628:

  • Dual triggers: pull_request_target added alongside pull_request, restricted to [opened, synchronize, reopened]. Both jobs gated by actor: pull_request runs for everyone except dependabot[bot], pull_request_target runs only for dependabot[bot]. No double-runs, no secrets exposed to fork PRs.
  • actions/checkout uses ref: ${{ github.event.pull_request.head.sha || github.sha }} in both discover-testcases and integration-tests, so the PR's actual code is tested under pull_request_target (which otherwise defaults to base) — and behavior is unchanged for push/pull_request.
  • Dependabot matrix restricted to alpha only (skipping cloud) to minimize credential blast radius for dependency-bump PRs.
  • Check secrets availability step emits a ::warning:: annotation when CLIENT_ID/CLIENT_SECRET/BASE_URL arrive empty. Future fork-PR failures will surface real context instead of cascading into the misleading UIPATH_ACCESS_TOKEN is not set downstream.
  • set -e + safe exit-code capture in testcases/{datetime-server,string-server,ground-to-cloud}/run.sh so the first failing command is what gets reported, not the cascading symptom.
  • timeout-minutes: 10 on the integration-tests job. The cloud jobs on PR chore(deps): bump python-multipart from 0.0.20 to 0.0.27 #198 were stuck in_progress for 3+ hours; this caps that.

Security tradeoff to acknowledge

pull_request_target runs the PR's code (uv sync installing the bumped dependency, then bash run.sh) with repo secrets in scope. For Dependabot PRs that means new dependency versions execute against real BASE_URL/CLIENT_ID/CLIENT_SECRET. If a malicious package version slips into the dependency tree (typosquat, hijacked maintainer, etc.), it runs with those creds. Mitigations baked into this PR:

  • Actor gate restricts pull_request_target to dependabot[bot] only — fork PRs from humans still use the no-secrets pull_request path.
  • Matrix restricted to alpha for Dependabot runs.

Optional further mitigations the maintainer can layer on top (not in this PR):

  • Mirror only the minimum subset of secrets into the Dependabot secrets store (Settings → Secrets and variables → Dependabot).
  • Gate the integration-tests job behind a GitHub Environment with required reviewers.

How this differs from the first version of this PR

This branch initially took the opposite approach — adding a .github/dependabot.yml with open-pull-requests-limit: 0 to block Dependabot from opening version-bump PRs (mirroring how uipath-python and uipath-langchain-python avoided the problem at the time). That commit has been superseded: the dependabot.yml file is removed, and the workflow is changed to let Dependabot's PRs actually run. The set -e and timeout-minutes hardening from that first attempt is kept.

Test plan

🤖 Generated with Claude Code

Mirror the dependabot.yml from uipath-python and uipath-langchain-python
so version-update PRs are not opened. They could not pass integration
tests because GitHub does not pass repository secrets to workflows
triggered by dependabot, leaving uipath auth without credentials.

Add timeout-minutes: 10 to the integration-tests job so hung jobs do
not sit "in progress" indefinitely. Add set -e to each run.sh so the
first failure is surfaced instead of cascading through init/pack/run
and ending with a misleading "UIPATH_ACCESS_TOKEN is not set".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 13, 2026 16:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates repository automation to reduce CI churn from Dependabot and make integration test execution more fail-fast and bounded in duration.

Changes:

  • Added a .github/dependabot.yml configuration that disables new Dependabot version-bump PRs (open-pull-requests-limit: 0) and excludes samples/**.
  • Added timeout-minutes: 10 to the GitHub Actions integration-tests job to prevent indefinite hangs.
  • Hardened the three integration testcase run.sh scripts by enabling set -e and preserving MCP server log output even when test.py fails.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
testcases/string-server/run.sh Enable set -e and capture test failures while still printing mcp_server_output.log.
testcases/ground-to-cloud/run.sh Same hardening as above for the ground-to-cloud testcase script.
testcases/datetime-server/run.sh Same hardening as above for the datetime testcase script.
.github/workflows/integration_tests.yml Add a 10-minute timeout to each integration test job to avoid stuck runs.
.github/dependabot.yml Add Dependabot configuration to stop opening new dependency PRs (and exclude samples).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Supersedes the dependabot.yml disable from the previous commit: instead
of blocking Dependabot from opening PRs, let them run integration tests
with secrets in scope. Port the pattern from uipath-python PR #1628:

- Add pull_request_target trigger alongside pull_request. Both gated by
  actor so each event fires only for its intended PR source — no
  double-runs and no secrets exposed to arbitrary fork PRs.
- Restrict the Dependabot matrix to alpha only to minimize the blast
  radius of running PR code with credentials in scope.
- actions/checkout uses ref: head.sha in both jobs so the PR's code is
  tested under pull_request_target (which defaults to base otherwise).
- Add a Check secrets availability step that emits a ::warning::
  annotation when CLIENT_ID/CLIENT_SECRET/BASE_URL arrive empty, so
  fork-PR failures have clear context instead of cascading into a
  misleading UIPATH_ACCESS_TOKEN error downstream.

set -e in run.sh and timeout-minutes from the previous commit are kept
as-is.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ionmincu ionmincu changed the title ci: add dependabot config and harden integration test scripts ci: let Dependabot integration tests run via pull_request_target May 13, 2026
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

discover-testcases:
if: |
github.event_name == 'push' ||
(github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') ||
if: |
github.event_name == 'push' ||
(github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') ||
(github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants