Skip to content

Conversation

devin-ai-integration[bot]
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jun 29, 2025

fix: skip deploy-pr-preview for external repository PRs

Summary

Fixed the deploy-pr-preview workflow that was failing when PRs come from external repositories (forks) by adding a condition to skip the preview deployment job for external PRs.

Root cause: The website preview workflow attempts to deploy to the gh-pages branch, which requires write permissions that external contributors don't have, causing the workflow to fail with permission errors.

Solution: Added the condition if: github.event.pull_request.head.repo.full_name == github.repository to the preview job in .github/workflows/website-preview.yml. This ensures the preview deployment only runs for PRs from the same repository, not from forks.

Impact: External PRs will no longer fail the deploy-pr-preview workflow, while internal PRs will continue to generate preview deployments as expected.

Review & Testing Checklist for Human

  • Verify YAML syntax is correct - Check that the added condition doesn't break the workflow syntax
  • Test with external PR - Create or find a PR from a fork and verify the preview job is skipped
  • Test with internal PR - Verify that PRs from the main repository still trigger preview deployments correctly

Diagram

%%{ init : { "theme" : "default" }}%%
graph TD
    PR["Pull Request Trigger"] --> PRC{{"PR Source Check<br/>head.repo.full_name == repository"}}
    
    PRC -->|"Internal PR<br/>(same repo)"| PREVIEW["preview job<br/>✅ Runs normally"]
    PRC -->|"External PR<br/>(fork)"| SKIP["preview job<br/>⚠️ Skipped"]
    
    PREVIEW --> CHECKOUT["Checkout code"]
    PREVIEW --> BUILD["Build website"] 
    PREVIEW --> DEPLOY["Deploy to gh-pages"]
    
    SKIP --> END["Workflow completes<br/>without errors"]
    DEPLOY --> END
    
    subgraph "Files"
        WPY[".github/workflows/website-preview.yml"]:::major-edit
    end
    
    subgraph Legend
        L1["Major Edit"]:::major-edit
        L2["Minor Edit"]:::minor-edit  
        L3["Context/No Edit"]:::context
    end

classDef major-edit fill:#90EE90
classDef minor-edit fill:#87CEEB  
classDef context fill:#FFFFFF
Loading

Notes

Link to Devin run: https://app.devin.ai/sessions/69baed5652b6435eafa7ed650bdc266e
Requested by: @azu

Add condition to prevent the website preview deployment from running
on PRs from forked repositories, which would fail due to lack of
write permissions to the gh-pages branch.

The condition 'github.event.pull_request.head.repo.full_name == github.repository'
ensures the preview job only runs for PRs from the same repository.

Co-Authored-By: azu <azuciao@gmail.com>
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@azu azu enabled auto-merge (squash) June 29, 2025 05:33
@azu azu added the Type: CI Changes to CI configuration files and scripts label Jun 29, 2025
Copy link
Contributor

PR Preview Action v1.6.1

🚀 View preview at
https://textlint.github.io/textlint/pr-preview/pr-1605/

Built to branch gh-pages at 2025-06-29 05:34 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@azu azu merged commit ee37d58 into master Jun 29, 2025
18 checks passed
@azu azu deleted the devin/1751175114-fix-deploy-pr-preview-external-repos branch June 29, 2025 05:36
@github-actions github-actions bot mentioned this pull request Jun 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: CI Changes to CI configuration files and scripts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant