How to run actions to build from a fork? #176785
Replies: 3 comments 2 replies
-
| 
         Enable GitHub Actions in your fork Go to your forked repository on GitHub. Click the “Actions” tab. You’ll see a message like: Click “I understand my workflows, go ahead and enable them.” Once enabled, you can manually trigger or push commits to run the workflows.  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         By default, GitHub Actions don’t automatically run on forks for security reasons — especially if the workflow uses secrets (like  
  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         The most likely fix is to enable Actions on your fork and add a manual trigger so you can run a build without relying on upstream events. Forks don’t inherit secrets, and many publish workflows only run on push or release in the source repo, so nothing fires in your fork until you enable workflows and give them a trigger. Open your fork’s Actions tab, click “Enable workflows,” then run a manual build. If it starts and the build job runs to completion, you’ve confirmed the problem was just disabled workflows and missing triggers. # .github/workflows/build.yml
name: Build on fork
on:
  workflow_dispatch:
  push:
    branches: [ main ]
permissions:
  contents: read
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 'lts/*'
          cache: 'npm'
      - run: npm ci
      - run: npm test
      - run: npm run build
  # Optional: keep publish steps in your fork but skip them
  # when running in a forked repository
  publish:
    if: ${{ !github.event.repository.fork }}
    needs: build
    runs-on: ubuntu-latest
    steps:
      - run: echo "Publish would happen in the upstream repo"This workflow adds a manual trigger, builds with your updated dependencies, and skips publishing when the run occurs in a fork. If the run still doesn’t start or publish steps fail, check whether the original workflow requires secrets (for npm or GitHub Packages). Add your own tokens as repository secrets in your fork, or keep publish disabled and use the build job only. If this solved your problem, please mark the answer as helpful so others can find it easily.  | 
  
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Why are you starting this discussion?
Question
What GitHub Actions topic or product is this about?
Misc
Discussion Details
I forked a respository that has this https://github.com/fails-components/webtransport/blob/master/.github/workflows/publish-packages.yml actions file to build. The third party dependencies need to be updated to work with TOT
node. How can I run those build actions from my fork?Beta Was this translation helpful? Give feedback.
All reactions