Skip to content

feat: allow PR workflows from forks#1547

Merged
Yermanaco merged 5 commits intomasterfrom
allow-workflows-from-forks
May 7, 2026
Merged

feat: allow PR workflows from forks#1547
Yermanaco merged 5 commits intomasterfrom
allow-workflows-from-forks

Conversation

@Yermanaco
Copy link
Copy Markdown
Contributor

@Yermanaco Yermanaco commented May 6, 2026

Fork PR workflows

Problems

  1. Fork PR previews were blocked by design, because deploy jobs with secrets must not run automatically on untrusted fork code.
  2. size-stats failed on fork PRs because it required GH_TOKEN_ACTIONS to checkout a private repository, and that secret is not available in fork-triggered pull_request runs.

Solution

  1. Fork preview deploys now use a controlled manual flow:
  • dedicated workflow_dispatch
  • PR must be open and from a fork
  • required label: safe-to-deploy
  • environment: production approval before using deploy secrets
  1. size-stats now works for forks using a two-step flow:
  • step A (pull_request): compute stats and upload artifact (no private token needed)
  • step B (workflow_run): trusted workflow reads artifact and updates PR comment

Result

  • Internal PR previews continue to run automatically.
  • Fork PR previews can be deployed under maintainer control.
  • size-stats works for fork PRs without exposing private credentials.

Note on label safe-to-deploy

The safe-to-deploy label is a manual signal that a PR is ready for deployment. It is not a security boundary by itself, but it serves as a checkpoint for maintainers to review the PR before allowing deploys. In the current setup, the environment approval is the actual security gate that protects secrets, while the label is a workflow control mechanism.

Repo permissions note for labels

Who can apply labels depends on repository permissions. According to the repository configuration, the following teams have elevated roles:

  • push teams: niji4home, novum-engineering, mistica-design, vivo-collaborators
  • admin teams: novum-web-core
  • pull teams (review-focused): network-tokenization, picara

Only collaborators or teams with at least Triage/Write/Maintain/Admin can add labels; non-collaborator external users cannot. If you rely on label-driven automation, make sure these teams are the ones trusted to apply the safe-to-deploy label as it is set in terraform repository settings here

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

Enables controlled workflows for forked PRs by separating untrusted computation from trusted actions that require write permissions or secrets (deploy previews and PR commenting).

Changes:

  • Updates size-stats to upload results as an artifact in the PR workflow, and adds a trusted workflow_run workflow to upsert the PR comment.
  • Adds a pull_request_target label listener to dispatch a manual, environment-gated fork preview deployment workflow.
  • Refactors internal PR preview deploy logic into a reusable composite action used by both internal and fork preview workflows.

Reviewed changes

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

Show a summary per file
File Description
.github/workflows/size-stats.yml Uploads size-stats output as an artifact instead of commenting directly (fork-safe).
.github/workflows/size-stats-comment.yml New trusted workflow_run job to download artifact and upsert the PR comment.
.github/workflows/label-trigger-deploy.yml New label-triggered dispatcher to start fork preview deploy workflow.
.github/workflows/deploy-pull-requests.yml Switches internal PR deploy to a shared composite action.
.github/workflows/deploy-fork-pr-preview.yml New environment-approved workflow to deploy fork PR previews by PR number.
.github/actions/deploy-vercel-preview/action.yml New composite action encapsulating checkout + preview build tweak + Vercel deploy.

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

Comment thread .github/workflows/label-trigger-deploy.yml
Comment thread .github/workflows/deploy-fork-pr-preview.yml Outdated
Comment thread .github/workflows/deploy-fork-pr-preview.yml Outdated
Comment thread .github/workflows/size-stats-comment.yml Outdated
Comment thread .github/actions/deploy-vercel-preview/action.yml Outdated
Comment thread .github/workflows/size-stats-comment.yml Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Accessibility report
✔️ No issues found

ℹ️ You can run this locally by executing yarn audit-accessibility.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Deploy preview for mistica-web ready!

Project:mistica-web
Status: ✅  Deploy successful!
Preview URL:https://mistica-o3xh6y8q5-flows-projects-65bb050e.vercel.app
Latest Commit:99d0e64

Deployed with vercel-action

Copilot AI review requested due to automatic review settings May 6, 2026 14:32
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

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

Comment thread .github/workflows/label-trigger-deploy.yml Outdated
Comment thread .github/workflows/deploy-fork-pr-preview.yml
needs: [master-size-stats, branch-size-stats]
steps:
- uses: actions/checkout@v6
with:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

if I do this, this PR would fail

Comment thread .github/actions/deploy-vercel-preview/action.yml Outdated
Comment thread .github/actions/deploy-vercel-preview/action.yml
@Yermanaco Yermanaco added this pull request to the merge queue May 7, 2026
Merged via the queue into master with commit 2270adc May 7, 2026
11 of 12 checks passed
@tuentisre
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 16.62.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

MurilloLeoni pushed a commit to MurilloLeoni/mistica-web that referenced this pull request May 8, 2026
# [16.62.0](Telefonica/mistica-web@v16.61.0...v16.62.0) (2026-05-08)

### Features

* **AiCard:** add new component aicard ([Telefonica#1544](Telefonica#1544)) ([96959e9](Telefonica@96959e9))
* allow PR workflows from forks ([Telefonica#1547](Telefonica#1547)) ([2270adc](Telefonica@2270adc)), closes [/github.com/Telefonica/tf-github-cdo-repos/blob/main/novum/repositories/mistica-web/terraform.tfvars#L23-L32](https://github.com//github.com/Telefonica/tf-github-cdo-repos/blob/main/novum/repositories/mistica-web/terraform.tfvars/issues/L23-L32)
* **Icons:** update artificial intelligence icons in vivo ([Telefonica#1545](Telefonica#1545)) ([f732114](Telefonica@f732114))
* **MenuItem:** Added description to MenuItem ([Telefonica#1543](Telefonica#1543)) ([a1f2e7d](Telefonica@a1f2e7d))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants