One Workflow for Me, Another for Others

With the help of this fine community I previously set up a workflow that lints my code and pushes it back to the pull request. I was told this would not work when coming from a fork as it used ref: ${{ github.event.pull_request.head.ref }} .

So, I now have a pull request from a fork and as expected the workflow fails with “branch not found”. I’d like to run the workflow only if it comes from me and isnt from a fork. I’ve set up a simpler workflow to run for others and I need this to run when it isnt me.

I tried the following but got an error of “Unexpected symbol: ‘“Snayff”’.” Even if that didnt error out I wonder if I am looking at the wrong property.

name: NQP - PR Review Snayff

on:
  pull_request:
    types: [opened, edited, synchronize]

jobs:
  job1:
    if: github.event.pusher.name == "Snayff"

Any help would be appreciated.

Snayff

Any ideas? Or is this not possible?

You need to use single quotes in expressions: 'Snayff'

You should also take a look here:

1 Like

You star, thank you - that was exactly it. I checked the following at job level.

if: ${{ github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}