Skip to content

[Bug] Disable deploy on fork repos #46

Description

@mumupika

I have noticed that a deployment failed triggered on my fork repo.
The deployment should only triggered on this repo but not on other forked repos for safety concerns.

You can have: deploy.yml modified to:

name: Deploy to GitHub Pages

on:
  push:
    branches: [main]
  # Allows you to run this workflow manually from the Actions tab on GitHub.
  workflow_dispatch:

# Allow this job to clone the repo and create a page deployment
permissions:
  contents: read
  pages: write
  id-token: write

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      CPPDOC_SITE: https://cppdoc.cc
    steps:
      - name: Checkout source code
        uses: actions/checkout@v6
      - name: Build and upload artifacts
        uses: withastro/action@v5

  deploy:
    needs: build
    runs-on: ubuntu-latest
    # disable the fork repo deployment.
    if: github.repository == 'cppdoc-cc/cppdoc'
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions