Skip to content

ci(e2e): allow fork PR runs via 'safe to test' label#55

Merged
mnsboev merged 2 commits into
mainfrom
ci/e2e-safe-to-test
May 7, 2026
Merged

ci(e2e): allow fork PR runs via 'safe to test' label#55
mnsboev merged 2 commits into
mainfrom
ci/e2e-safe-to-test

Conversation

@mnsboev
Copy link
Copy Markdown
Collaborator

@mnsboev mnsboev commented May 7, 2026

Summary

GitHub blocks repository secrets on workflows triggered by pull_request from a fork. As a result, the SaaS E2E job in e2e-tests.yml was running on every fork PR with empty --jfrog.url, --jfrog.adminToken, --jfrog.evidenceToken, --jfrog.projectToken, and --jfrog.projectKey, and exiting with ERROR: Project token is required for Evidence Project CLI. (e.g. #54, run 25363481561).

This PR introduces an opt-in, label-gated path for fork PRs:

  • Skip e2e-tests-saas on fork pull_request events. Removes the misleading red X. Internal PRs continue to run unchanged.
  • Add pull_request_target trigger gated on a safe to test label. A maintainer applies the label only after reviewing the fork's diff; the job then checks out the PR head SHA (persist-credentials: false) and runs E2E.
  • Auto-remove the safe to test label on synchronize. New commits force a maintainer to re-review and re-apply the label before E2E runs again.
  • Add safe to test to the PR Label Check allowlist so the labeled PR doesn't fail pr-labels.yml.

Notes

pull_request_target runs the workflow file from the base ref (so the gate cannot be bypassed by editing the workflow inside a PR). The label is the trust boundary:

  • Only users with Triage+ on the repo can apply labels (outside contributors / fork PR authors cannot).
  • Reviewers must read the PR's full diff (including go.mod, go.sum, scripts, tests) before applying safe to test. Treat applying the label as a code-execution approval.
  • The auto-remove-on-synchronize step ensures new commits don't get a free re-run with the previously granted trust.

Operating the flow after merge

  1. Create the safe to test label on the repo (gh label create "safe to test" --repo jfrog/jfrog-cli-evidence --color B60205 --description "Trusted reviewer approves running SaaS E2E on this PR").
  2. For an inbound fork PR, review the diff, then gh pr edit <num> --add-label "safe to test".
  3. The E2E Tests on SaaS Environment run will appear on the PR, checked out at the PR head SHA, with all secrets.* populated.

Test plan

  • CI runs on this internal PR exactly as before (push + same-repo pull_request); no behavior change for internal PRs.
  • After merge, create the safe to test label.
  • Apply the label to Add --format flag support to create-evidence #54 and confirm a new E2E Tests on SaaS Environment run starts that checks out commit 0df2f83… and runs past the token initialization (i.e. real test results, not the "Project token is required" error).
  • Push a new commit on Add --format flag support to create-evidence #54 and confirm the label is auto-removed (no E2E re-run without re-approval).

GitHub blocks secrets on workflows triggered by pull_request from a fork,
which made the existing e2e-tests-saas job fail with empty tokens for
every fork PR (e.g. #54). Updates:

- Skip e2e-tests-saas on fork pull_request events to avoid the
  misleading red X. Internal PRs continue to run E2E unchanged.
- Add a pull_request_target trigger gated on the 'safe to test' label
  so a maintainer can opt-in a fork PR to run E2E with secrets after
  reviewing the diff. Workflow checks out the PR head SHA explicitly
  with persist-credentials disabled.
- Auto-remove the 'safe to test' label on synchronize so new commits
  require fresh maintainer approval before E2E runs again with secrets.
- Add 'safe to test' to the PR Label Check allowlist so the labeled
  PR doesn't fail the label-check job.

Co-authored-by: Cursor <cursoragent@cursor.com>
@mnsboev mnsboev added the improvement General improvements to the codebase label May 7, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

👍 Frogbot scanned this pull request and did not find any new security issues.


@mnsboev mnsboev merged commit b58a3e3 into main May 7, 2026
19 checks passed
@mnsboev mnsboev deleted the ci/e2e-safe-to-test branch May 7, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement General improvements to the codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants