Enabling Github Actions in a repository

My actions trigger is setup as -

      - master
      - master

I have noticed that adding a .github/workflows/foo.yml to the branch of a repository and then creating a pull request to the master branch of that same repository, triggers the action.

But creating a pull request to the master branch of a different repository (from which this is forked), did not trigger the action. Will getting the pull request merged, trigger the action? Is there a way to trigger the action in the pull request itself?

When you merge a pull request into master, on: push will trigger a workflow run.

Is your base repository private by any chance? Because workflows don’t run on private base repositories when you open a pull request from a forked repository. But looks like you can enable it if you want to:

If the source repo is public, then a pull_request event should occur, even if the branch is from a different repo (fork).

Or do you want the workflow to run in the forked repo? Workflows don’t run on forked repositories by default. You must enable GitHub Actions in the Actions tab of the forked repository.

See Pull request events for forked repositories